Fix a null pointer exception if a certain world has no gates.

This commit is contained in:
Tobias Ottenweller 2013-02-23 19:52:41 +01:00
parent 606ea1d5c5
commit e54914bd22

View File

@ -68,6 +68,8 @@ public class PluginPortalListener implements Listener
Location eventLocation = event.getLocation();
Gate closestGate = GateUtil.closestGate(eventLocation);
if (closestGate != null)
{
// Make sure gate and event locations are on the same height (y-value).
// Otherwise the distance will be messed up when players are flying.
// FIX ME: this could potentially let a nearby nether portal fail!
@ -82,7 +84,7 @@ public class PluginPortalListener implements Listener
this.currentGateAtEvent.put(player, closestGate);
return;
}
}
}
this.currentGateAtEvent.put(player, null);