diff --git a/src/main/java/eu/pb4/destroythemonument/game/WaitingLobby.java b/src/main/java/eu/pb4/destroythemonument/game/WaitingLobby.java index da1abfe..2218297 100644 --- a/src/main/java/eu/pb4/destroythemonument/game/WaitingLobby.java +++ b/src/main/java/eu/pb4/destroythemonument/game/WaitingLobby.java @@ -88,6 +88,8 @@ public static GameOpenProcedure open(GameOpenContext context) { throw new GameOpenException(Text.literal("Map couldn't load! @Patbox pls fix"), e); } + map.validate(); + RuntimeWorldConfig worldConfig = new RuntimeWorldConfig() .setGenerator(map.asGenerator(context.server())) .setTimeOfDay(config.map().time()) diff --git a/src/main/java/eu/pb4/destroythemonument/game/data/TeamData.java b/src/main/java/eu/pb4/destroythemonument/game/data/TeamData.java index c7bb2e3..c9fc430 100644 --- a/src/main/java/eu/pb4/destroythemonument/game/data/TeamData.java +++ b/src/main/java/eu/pb4/destroythemonument/game/data/TeamData.java @@ -11,6 +11,7 @@ import org.jetbrains.annotations.Nullable; import xyz.nucleoid.map_templates.BlockBounds; import xyz.nucleoid.map_templates.TemplateRegion; +import xyz.nucleoid.plasmid.api.game.GameOpenException; import xyz.nucleoid.plasmid.api.game.common.team.GameTeam; import xyz.nucleoid.plasmid.api.game.common.team.GameTeamConfig; import xyz.nucleoid.plasmid.api.game.common.team.GameTeamKey; @@ -47,6 +48,11 @@ public BlockPos getRandomSpawnPos() { public void setTeamRegions(List spawn, float spawnYaw, List monuments, Set classChange, GameMap map, GameConfig config) { this.spawn = spawn; this.spawnYaw = spawnYaw; + + if (this.spawn.isEmpty()) { + throw new GameOpenException(Text.literal("No valid spawns for " + this.team.id())); + } + int id = 0; for (var region : monuments) { diff --git a/src/main/java/eu/pb4/destroythemonument/game/map/GameMap.java b/src/main/java/eu/pb4/destroythemonument/game/map/GameMap.java index db8b319..68a69ca 100644 --- a/src/main/java/eu/pb4/destroythemonument/game/map/GameMap.java +++ b/src/main/java/eu/pb4/destroythemonument/game/map/GameMap.java @@ -7,11 +7,13 @@ import eu.pb4.destroythemonument.game.data.TeamData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.world.ServerWorld; +import net.minecraft.text.Text; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.gen.chunk.ChunkGenerator; import org.jetbrains.annotations.Nullable; import xyz.nucleoid.map_templates.BlockBounds; +import xyz.nucleoid.plasmid.api.game.GameOpenException; import xyz.nucleoid.plasmid.api.game.common.team.GameTeamKey; @@ -44,6 +46,12 @@ public GameMap(MapConfig config, BlockBounds mapBounds) { } + public void validate() { + if (this.validSpawn.isEmpty()) { + throw new GameOpenException(Text.literal("No valid waiting spawns")); + } + } + public abstract ChunkGenerator asGenerator(MinecraftServer server); public boolean isUnbreakable(BlockPos block) {