diff --git a/src/de/craftinc/gates/Gate.java b/src/de/craftinc/gates/Gate.java index be1157d..97d41c2 100644 --- a/src/de/craftinc/gates/Gate.java +++ b/src/de/craftinc/gates/Gate.java @@ -72,11 +72,11 @@ public class Gate extends BaseGate implements ConfigurationSerializable @SuppressWarnings("unchecked") public Gate(Map map) { - id = (String)map.get(idKey); - isHidden = (Boolean)map.get(isHiddenKey); - isOpen = (Boolean)map.get(isOpenKey); - try { + id = map.get(idKey).toString(); + isHidden = (Boolean)map.get(isHiddenKey); + isOpen = (Boolean)map.get(isOpenKey); + location = LocationSerializer.deserializeLocation((Map) map.get(locationKey)); exit = LocationSerializer.deserializeLocation((Map) map.get(exitKey)); diff --git a/src/de/craftinc/gates/util/LocationSerializer.java b/src/de/craftinc/gates/util/LocationSerializer.java index 36ba1a2..e295484 100644 --- a/src/de/craftinc/gates/util/LocationSerializer.java +++ b/src/de/craftinc/gates/util/LocationSerializer.java @@ -34,6 +34,10 @@ public class LocationSerializer public static Map serializeLocation(Location l) { + if (l == null) { + return null; + } + Map serializedLocation = new HashMap(); serializedLocation.put(worldKey, l.getWorld().getName()); @@ -47,6 +51,10 @@ public class LocationSerializer public static Location deserializeLocation(Map map) throws Exception { + if (map == null) { + return null; + } + World w = getWorld((String)map.get(worldKey));