From ea52e4d87e142c729deb204c113ca2a0f282efcf Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Sun, 23 Jun 2013 18:46:03 +0200 Subject: [PATCH] Also check for the players head locations when trying to teleport the player. --- .../gates/listeners/PlayerMoveListener.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/de/craftinc/gates/listeners/PlayerMoveListener.java b/src/de/craftinc/gates/listeners/PlayerMoveListener.java index a3fdce3..6332ceb 100644 --- a/src/de/craftinc/gates/listeners/PlayerMoveListener.java +++ b/src/de/craftinc/gates/listeners/PlayerMoveListener.java @@ -52,15 +52,21 @@ public class PlayerMoveListener implements Listener Gate gateAtLocation = gateManager.getGateAtLocation(event.getTo()); 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()) { return; } - - System.out.println("player: " + event.getPlayer() + " location: " + event.getTo()); - // Check for permission if (!hasPermission(event.getPlayer(), gateAtLocation)