Implement method to check if setup is complete
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ace286c982
commit
0783505dce
@ -70,7 +70,7 @@ public class UhcUtils {
|
|||||||
|
|
||||||
public static void tpSpawnAndGiveItem(Player player)
|
public static void tpSpawnAndGiveItem(Player player)
|
||||||
{
|
{
|
||||||
if(Cache.spawn == null)
|
if(Cache.isServerReady)
|
||||||
{
|
{
|
||||||
MessageUtils.sendLocalizedMessage(player, LocalizedMessage.ERROR_SERVER_NOT_SET_UP);
|
MessageUtils.sendLocalizedMessage(player, LocalizedMessage.ERROR_SERVER_NOT_SET_UP);
|
||||||
return;
|
return;
|
||||||
|
@ -127,6 +127,9 @@ public class FileUtils
|
|||||||
Cache.fireworksLocations.add(new Location(plugin.getServer().getWorld(world), x, y, z));
|
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.
|
// Only reload the needed File.
|
||||||
@ -282,4 +285,15 @@ public class FileUtils
|
|||||||
yaml = yamlConfig;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user