diff --git a/src/main/java/wtf/beatrice/uhccore/utils/UhcUtils.java b/src/main/java/wtf/beatrice/uhccore/utils/UhcUtils.java index 436c4f2..a662da7 100644 --- a/src/main/java/wtf/beatrice/uhccore/utils/UhcUtils.java +++ b/src/main/java/wtf/beatrice/uhccore/utils/UhcUtils.java @@ -70,7 +70,7 @@ public class UhcUtils { public static void tpSpawnAndGiveItem(Player player) { - if(Cache.spawn == null) + if(Cache.isServerReady) { MessageUtils.sendLocalizedMessage(player, LocalizedMessage.ERROR_SERVER_NOT_SET_UP); return; diff --git a/src/main/java/wtf/beatrice/uhccore/utils/configuration/FileUtils.java b/src/main/java/wtf/beatrice/uhccore/utils/configuration/FileUtils.java index e1126a1..3952216 100644 --- a/src/main/java/wtf/beatrice/uhccore/utils/configuration/FileUtils.java +++ b/src/main/java/wtf/beatrice/uhccore/utils/configuration/FileUtils.java @@ -127,6 +127,9 @@ public class FileUtils Cache.fireworksLocations.add(new Location(plugin.getServer().getWorld(world), x, y, z)); } + // after reloading everything, check if the server is ready for gameplay. + Cache.isServerReady = isServerSetUp(); + } // Only reload the needed File. @@ -282,4 +285,15 @@ public class FileUtils yaml = yamlConfig; } } + + private static boolean isServerSetUp() { + + if(Cache.spawn == null) return false; + if(Cache.lobbyWorlds == null || Cache.lobbyWorlds.isEmpty()) return false; + if(Cache.totalTeams <= 1) return false; + if(Cache.fireworksLocations == null) return false; + if(Cache.uhcWorlds == null || Cache.uhcWorlds.isEmpty()) return false; + + return false; + } }