Also check for the players head locations when trying to teleport the player.

This commit is contained in:
Tobias Ottenweller 2013-06-23 18:46:03 +02:00
parent f4495240a5
commit ea52e4d87e

View File

@ -52,15 +52,21 @@ public class PlayerMoveListener implements Listener
Gate gateAtLocation = gateManager.getGateAtLocation(event.getTo()); Gate gateAtLocation = gateManager.getGateAtLocation(event.getTo());
if (gateAtLocation == null) { if (gateAtLocation == null) {
return; Location headTo = new Location(event.getTo().getWorld(),
event.getTo().getX(),
event.getTo().getY()+1.0,
event.getTo().getZ());
gateAtLocation = gateManager.getGateAtLocation(headTo);
if (gateAtLocation == null) {
return;
}
} }
if (!gateAtLocation.isOpen()) { if (!gateAtLocation.isOpen()) {
return; return;
} }
System.out.println("player: " + event.getPlayer() + " location: " + event.getTo());
// Check for permission // Check for permission
if (!hasPermission(event.getPlayer(), gateAtLocation) if (!hasPermission(event.getPlayer(), gateAtLocation)