Fixed bug where gates with no exit did cause an exception.
This commit is contained in:
parent
a677995968
commit
776e4ef3c9
@ -72,11 +72,11 @@ public class Gate extends BaseGate implements ConfigurationSerializable
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Gate(Map<String, Object> map)
|
public Gate(Map<String, Object> map)
|
||||||
{
|
{
|
||||||
id = (String)map.get(idKey);
|
|
||||||
isHidden = (Boolean)map.get(isHiddenKey);
|
|
||||||
isOpen = (Boolean)map.get(isOpenKey);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
id = map.get(idKey).toString();
|
||||||
|
isHidden = (Boolean)map.get(isHiddenKey);
|
||||||
|
isOpen = (Boolean)map.get(isOpenKey);
|
||||||
|
|
||||||
location = LocationSerializer.deserializeLocation((Map<String, Object>) map.get(locationKey));
|
location = LocationSerializer.deserializeLocation((Map<String, Object>) map.get(locationKey));
|
||||||
exit = LocationSerializer.deserializeLocation((Map<String, Object>) map.get(exitKey));
|
exit = LocationSerializer.deserializeLocation((Map<String, Object>) map.get(exitKey));
|
||||||
|
|
||||||
|
@ -34,6 +34,10 @@ public class LocationSerializer
|
|||||||
|
|
||||||
public static Map<String, Object> serializeLocation(Location l)
|
public static Map<String, Object> serializeLocation(Location l)
|
||||||
{
|
{
|
||||||
|
if (l == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, Object> serializedLocation = new HashMap<String, Object>();
|
Map<String, Object> serializedLocation = new HashMap<String, Object>();
|
||||||
|
|
||||||
serializedLocation.put(worldKey, l.getWorld().getName());
|
serializedLocation.put(worldKey, l.getWorld().getName());
|
||||||
@ -47,6 +51,10 @@ public class LocationSerializer
|
|||||||
|
|
||||||
public static Location deserializeLocation(Map<String, Object> map) throws Exception
|
public static Location deserializeLocation(Map<String, Object> map) throws Exception
|
||||||
{
|
{
|
||||||
|
if (map == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
World w = getWorld((String)map.get(worldKey));
|
World w = getWorld((String)map.get(worldKey));
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user