Revert previous changes to Arena serialization back to LocationSerializable until we work out a migration of existing configs.
This commit is contained in:
parent
990a8bf771
commit
ad01ed1e75
@ -5,9 +5,9 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||||
import org.bukkit.configuration.serialization.SerializableAs;
|
import org.bukkit.configuration.serialization.SerializableAs;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -17,8 +17,8 @@ import org.bukkit.scoreboard.Scoreboard;
|
|||||||
@SerializableAs("BlockHuntArena")
|
@SerializableAs("BlockHuntArena")
|
||||||
public class Arena implements ConfigurationSerializable {
|
public class Arena implements ConfigurationSerializable {
|
||||||
public String arenaName;
|
public String arenaName;
|
||||||
public Location pos1;
|
public LocationSerializable pos1;
|
||||||
public Location pos2;
|
public LocationSerializable pos2;
|
||||||
public int maxPlayers;
|
public int maxPlayers;
|
||||||
public int minPlayers;
|
public int minPlayers;
|
||||||
public int amountSeekersOnStart;
|
public int amountSeekersOnStart;
|
||||||
@ -33,10 +33,10 @@ public class Arena implements ConfigurationSerializable {
|
|||||||
public boolean seekersTakeFallDamage;
|
public boolean seekersTakeFallDamage;
|
||||||
public boolean hidersTakeFallDamage;
|
public boolean hidersTakeFallDamage;
|
||||||
public ArrayList<ItemStack> disguiseBlocks;
|
public ArrayList<ItemStack> disguiseBlocks;
|
||||||
public Location lobbyWarp;
|
public LocationSerializable lobbyWarp;
|
||||||
public Location hidersWarp;
|
public LocationSerializable hidersWarp;
|
||||||
public Location seekersWarp;
|
public LocationSerializable seekersWarp;
|
||||||
public Location spawnWarp;
|
public LocationSerializable spawnWarp;
|
||||||
public List<String> seekersWinCommands;
|
public List<String> seekersWinCommands;
|
||||||
public List<String> hidersWinCommands;
|
public List<String> hidersWinCommands;
|
||||||
public List<String> allowedCommands;
|
public List<String> allowedCommands;
|
||||||
@ -50,10 +50,10 @@ public class Arena implements ConfigurationSerializable {
|
|||||||
public List<Player> seekers;
|
public List<Player> seekers;
|
||||||
public Scoreboard scoreboard;
|
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,
|
int timeInLobbyUntilStart, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword, int blockAnnouncerTime,
|
||||||
boolean seekersCanHurtSeekers, boolean hidersCanHurtSeekers, boolean hidersCanHurtHiders, boolean seekersTakeFallDamage, boolean hidersTakeFallDamage,
|
boolean seekersCanHurtSeekers, boolean hidersCanHurtSeekers, boolean hidersCanHurtHiders, boolean seekersTakeFallDamage, boolean hidersTakeFallDamage,
|
||||||
ArrayList<ItemStack> disguiseBlocks, Location lobbyWarp, Location hidersWarp, Location seekersWarp, Location spawnWarp,
|
ArrayList<ItemStack> disguiseBlocks, LocationSerializable lobbyWarp, LocationSerializable hidersWarp, LocationSerializable seekersWarp, LocationSerializable spawnWarp,
|
||||||
List<String> seekersWinCommands, List<String> hidersWinCommands, List<String> allowedCommands, int seekersTokenWin, int hidersTokenWin, int killTokens,
|
List<String> seekersWinCommands, List<String> hidersWinCommands, List<String> allowedCommands, int seekersTokenWin, int hidersTokenWin, int killTokens,
|
||||||
List<Player> playersInArena, ArenaState gameState, int timer, List<Player> seekers, Scoreboard scoreboard) {
|
List<Player> playersInArena, ArenaState gameState, int timer, List<Player> seekers, Scoreboard scoreboard) {
|
||||||
this.arenaName = arenaName;
|
this.arenaName = arenaName;
|
||||||
@ -143,13 +143,13 @@ public class Arena implements ConfigurationSerializable {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static Arena deserialize(Map<String, Object> map) {
|
public static Arena deserialize(Map<String, Object> map) {
|
||||||
Location loc = new Location(Bukkit.getWorld("world"), 0, 0, 0, 0, 0);
|
LocationSerializable loc = new LocationSerializable(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),
|
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( "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),
|
(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),
|
(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<ItemStack>) map.getOrDefault( "disguiseBlocks", new ArrayList<ItemStack>()),(Location) map.getOrDefault( "lobbyWarp", loc), (Location) map.getOrDefault( "hidersWarp", loc), (Location) map.getOrDefault( "seekersWarp", loc),
|
(ArrayList<ItemStack>) map.getOrDefault( "disguiseBlocks", new ArrayList<ItemStack>()),(LocationSerializable) map.getOrDefault( "lobbyWarp", loc), (LocationSerializable) map.getOrDefault( "hidersWarp", loc), (LocationSerializable) map.getOrDefault( "seekersWarp", loc),
|
||||||
(Location) map.getOrDefault( "spawnWarp", loc), (ArrayList<String>) map.getOrDefault( "seekersWinCommands", new ArrayList<String>()),
|
(LocationSerializable) map.getOrDefault( "spawnWarp", loc), (ArrayList<String>) map.getOrDefault( "seekersWinCommands", new ArrayList<String>()),
|
||||||
(ArrayList<String>) map.getOrDefault("hidersWinCommands", new ArrayList<String>()), (ArrayList<String>) map.getOrDefault( "allowedCommands", new ArrayList<String>()),
|
(ArrayList<String>) map.getOrDefault("hidersWinCommands", new ArrayList<String>()), (ArrayList<String>) map.getOrDefault( "allowedCommands", new ArrayList<String>()),
|
||||||
(Integer) map.getOrDefault( "seekersTokenWin", 10), (Integer) map.getOrDefault( "hidersTokenWin", 50), (Integer) map.getOrDefault( "killTokens", 8), 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());
|
ArenaState.WAITING, 0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user