diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/MylesAndMore/tumble/Game.java | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/main/java/com/MylesAndMore/tumble/Game.java b/src/main/java/com/MylesAndMore/tumble/Game.java index 6135cfd..2161e2f 100644 --- a/src/main/java/com/MylesAndMore/tumble/Game.java +++ b/src/main/java/com/MylesAndMore/tumble/Game.java @@ -1,17 +1,18 @@ package com.MylesAndMore.tumble; -import com.MylesAndMore.tuble.TumbleManager; +import com.MylesAndMore.tumble.TumbleManager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.Location; import org.bukkit.World; -import Java.util.Arrays; -import Java.util.Collections; -import Java.util.List; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Objects; public final class Game { - // Define the gameInstnace + // Define the gameInstance private static Game gameInstance; // Private Game() constructor for singleton instance @@ -21,22 +22,22 @@ public final class Game { // Define local game vars // The gameType keeps the current game type (shocker) - String gameType = null; + static String gameType = null; // Creates a new Game // This will return true if the game succeeds creation, and false if not private static boolean createGame() { if (Objects.equals(TumbleManager.getGameType(), "shovels")) { // shovels logic - gameType = "shovels" + gameType = "shovels"; } else if (Objects.equals(TumbleManager.getGameType(), "snowballs")) { // snowballs - gameType = "snowballs" + gameType = "snowballs"; } else if (Objects.equals(TumbleManager.getGameType(), "mixed")) { // mixed (choose random shovels or snowballs) - gameType = "mixed" + gameType = "mixed"; } else { // The game type in the config did not match a specified game type; return false to signify that @@ -45,32 +46,31 @@ public final class Game { return true; } - private static boolean sendPlayers() { + private static void sendPlayers() { World gameWorld = Bukkit.getWorld(TumbleManager.getGameWorld()); // Define the game world's spawnpoint as a new Location - Location gameSpawn = new Location(gameWorld.getSpawnLocation()); + Location gameSpawn = gameWorld.getSpawnLocation(); // Get the X, Y, and Z coords of that location - int x = gameSpawn.getX(); - int y = gameSpawn.getY(); - int z = gameSpawn.getZ(); + double x = gameSpawn.getX(); + double y = gameSpawn.getY(); + double z = gameSpawn.getZ(); // Create Locations to scatter players around the first layer // These are just edited off the original spawn location; // they assume that the first layer has a radius of 17 blocks (it always will w/ the current generator code) List<Location> scatterLocations = Arrays.asList( - new Location(gameWorld, (x - 16), y, z); - new Location(gameWorld, x, y, (z - 16)); - new Location(gameWorld, (x + 16), y, z);; - new Location(gameWorld, x, y, (z + 16)) - ); + new Location(gameWorld, (x - 16), y, z), + new Location(gameWorld, x, y, (z - 16)), + new Location(gameWorld, (x + 16), y, z), + new Location(gameWorld, x, y, (z + 16))); // Shuffle the location list so players don't always spawn in the same location (basically, actually scatter the locations) Collections.shuffle(scatterLocations); // While there are still players in the lobby, send them to the gameWorld // This is just a way of sending everybody in the lobby to the game - for (List<Player> playersInLobby = TumbleManager.getPlayersInLobby(); playersInLobby.size() > 0; playersInLobby = TumbleManager.getPlayersInLobby() & scatterLoations.remove(0)) { + for (List<Player> playersInLobby = TumbleManager.getPlayersInLobby(); playersInLobby.size() > 0; playersInLobby = TumbleManager.getPlayersInLobby(), scatterLocations.remove(0)) { // Get a singular player from the player list Player aPlayer = playersInLobby.get(0); // Get a singular location from the scatter list - Location aLocation = scatterLoations.get(0); + Location aLocation = scatterLocations.get(0); // Teleport that player to that scatter location aPlayer.teleport(aLocation); } |