Also check for the players head locations when trying to teleport the player.
This commit is contained in:
parent
f4495240a5
commit
ea52e4d87e
@ -51,17 +51,23 @@ public class PlayerMoveListener implements Listener
|
|||||||
GatesManager gateManager = Plugin.getPlugin().getGatesManager();
|
GatesManager gateManager = Plugin.getPlugin().getGatesManager();
|
||||||
Gate gateAtLocation = gateManager.getGateAtLocation(event.getTo());
|
Gate gateAtLocation = gateManager.getGateAtLocation(event.getTo());
|
||||||
|
|
||||||
|
if (gateAtLocation == null) {
|
||||||
|
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) {
|
if (gateAtLocation == null) {
|
||||||
return;
|
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)
|
||||||
&& Plugin.getPlugin().getConfig().getBoolean(Plugin.confShowTeleportNoPermissionMessageKey)) {
|
&& Plugin.getPlugin().getConfig().getBoolean(Plugin.confShowTeleportNoPermissionMessageKey)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user