From ad01ed1e757c00e19f84a18d09c1314995f731f4 Mon Sep 17 00:00:00 2001 From: Narimm Date: Mon, 15 Jan 2018 17:34:18 +1000 Subject: [PATCH] Revert previous changes to Arena serialization back to LocationSerializable until we work out a migration of existing configs. --- .../java/nl/Steffion/BlockHunt/Arena.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/nl/Steffion/BlockHunt/Arena.java b/src/main/java/nl/Steffion/BlockHunt/Arena.java index f5ff151..e65cf4c 100644 --- a/src/main/java/nl/Steffion/BlockHunt/Arena.java +++ b/src/main/java/nl/Steffion/BlockHunt/Arena.java @@ -5,9 +5,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import nl.Steffion.BlockHunt.Serializables.LocationSerializable; import org.bukkit.Bukkit; -import org.bukkit.Location; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.configuration.serialization.SerializableAs; import org.bukkit.entity.Player; @@ -17,8 +17,8 @@ import org.bukkit.scoreboard.Scoreboard; @SerializableAs("BlockHuntArena") public class Arena implements ConfigurationSerializable { public String arenaName; - public Location pos1; - public Location pos2; + public LocationSerializable pos1; + public LocationSerializable pos2; public int maxPlayers; public int minPlayers; public int amountSeekersOnStart; @@ -33,10 +33,10 @@ public class Arena implements ConfigurationSerializable { public boolean seekersTakeFallDamage; public boolean hidersTakeFallDamage; public ArrayList disguiseBlocks; - public Location lobbyWarp; - public Location hidersWarp; - public Location seekersWarp; - public Location spawnWarp; + public LocationSerializable lobbyWarp; + public LocationSerializable hidersWarp; + public LocationSerializable seekersWarp; + public LocationSerializable spawnWarp; public List seekersWinCommands; public List hidersWinCommands; public List allowedCommands; @@ -50,10 +50,10 @@ public class Arena implements ConfigurationSerializable { public List seekers; public Scoreboard scoreboard; - public Arena(String arenaName, Location pos1, Location pos2, int maxPlayers, int minPlayers, int amountSeekersOnStart, + public Arena(String arenaName, LocationSerializable pos1, LocationSerializable pos2, int maxPlayers, int minPlayers, int amountSeekersOnStart, int timeInLobbyUntilStart, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword, int blockAnnouncerTime, boolean seekersCanHurtSeekers, boolean hidersCanHurtSeekers, boolean hidersCanHurtHiders, boolean seekersTakeFallDamage, boolean hidersTakeFallDamage, - ArrayList disguiseBlocks, Location lobbyWarp, Location hidersWarp, Location seekersWarp, Location spawnWarp, + ArrayList disguiseBlocks, LocationSerializable lobbyWarp, LocationSerializable hidersWarp, LocationSerializable seekersWarp, LocationSerializable spawnWarp, List seekersWinCommands, List hidersWinCommands, List allowedCommands, int seekersTokenWin, int hidersTokenWin, int killTokens, List playersInArena, ArenaState gameState, int timer, List seekers, Scoreboard scoreboard) { this.arenaName = arenaName; @@ -143,13 +143,13 @@ public class Arena implements ConfigurationSerializable { @SuppressWarnings("unchecked") public static Arena deserialize(Map map) { - Location loc = new Location(Bukkit.getWorld("world"), 0, 0, 0, 0, 0); - return new Arena((String) map.getOrDefault("arenaName", "UNKNOWN_NAME"), (Location) map.getOrDefault("pos1", loc), (Location) map.getOrDefault( "pos2", loc), + LocationSerializable loc = new LocationSerializable(Bukkit.getWorld("world"), 0, 0, 0, 0, 0); + return new Arena((String) map.getOrDefault("arenaName", "UNKNOWN_NAME"), (LocationSerializable) map.getOrDefault("pos1", loc), (LocationSerializable) map.getOrDefault( "pos2", loc), (Integer) map.getOrDefault( "maxPlayers", 12), (Integer) map.getOrDefault( "minPlayers", 3), (Integer) map.getOrDefault( "amountSeekersOnStart", 1), (Integer) map.getOrDefault( "timeInLobbyUntilStart", 90), (Integer) map.getOrDefault( "waitingTimeSeeker", 20), (Integer) map.getOrDefault( "gameTime", 200), (Integer) map.getOrDefault( "timeUntilHidersSword", 30),(Integer) map.getOrDefault( "blockAnnouncerTime", 45), (Boolean) map.getOrDefault( "seekersCanHurtSeekers", false),(Boolean) map.getOrDefault( "hidersCanHurtSeekers", false),(Boolean) map.getOrDefault( "hidersCanHurtHiders", false),(Boolean) map.getOrDefault( "seekersTakeFallDamage", false),(Boolean) map.getOrDefault( "hidersTakeFallDamage", false), - (ArrayList) map.getOrDefault( "disguiseBlocks", new ArrayList()),(Location) map.getOrDefault( "lobbyWarp", loc), (Location) map.getOrDefault( "hidersWarp", loc), (Location) map.getOrDefault( "seekersWarp", loc), - (Location) map.getOrDefault( "spawnWarp", loc), (ArrayList) map.getOrDefault( "seekersWinCommands", new ArrayList()), + (ArrayList) map.getOrDefault( "disguiseBlocks", new ArrayList()),(LocationSerializable) map.getOrDefault( "lobbyWarp", loc), (LocationSerializable) map.getOrDefault( "hidersWarp", loc), (LocationSerializable) map.getOrDefault( "seekersWarp", loc), + (LocationSerializable) map.getOrDefault( "spawnWarp", loc), (ArrayList) map.getOrDefault( "seekersWinCommands", new ArrayList()), (ArrayList) map.getOrDefault("hidersWinCommands", new ArrayList()), (ArrayList) map.getOrDefault( "allowedCommands", new ArrayList()), (Integer) map.getOrDefault( "seekersTokenWin", 10), (Integer) map.getOrDefault( "hidersTokenWin", 50), (Integer) map.getOrDefault( "killTokens", 8), new ArrayList<>(), ArenaState.WAITING, 0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard());