Fix the world border issue

Signed-off-by: matt <4009945+MattBDev@users.noreply.github.com>
This commit is contained in:
matt 2019-02-05 20:36:42 -05:00
parent 9a23b718f3
commit ccc53278a1

View File

@ -650,7 +650,6 @@ import java.util.regex.Pattern;
} }
} }
} }
return;
} }
playerMove(event); playerMove(event);
} }
@ -772,7 +771,6 @@ import java.util.regex.Pattern;
} }
} else if (now.equals(lastPlot)) { } else if (now.equals(lastPlot)) {
ForceFieldListener.handleForcefield(player, pp, now); ForceFieldListener.handleForcefield(player, pp, now);
return;
} else if (!plotEntry(pp, now) && this.tmpTeleport) { } else if (!plotEntry(pp, now) && this.tmpTeleport) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED);
this.tmpTeleport = false; this.tmpTeleport = false;
@ -785,22 +783,19 @@ import java.util.regex.Pattern;
} }
Integer border = area.getBorder(); Integer border = area.getBorder();
if (x2 > border && this.tmpTeleport) { if (x2 > border && this.tmpTeleport) {
to.setX(x2 - 1); to.setX(border - 1);
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
MainUtil.sendMessage(pp, C.BORDER); MainUtil.sendMessage(pp, C.BORDER);
return;
} }
if (x2 < -border && this.tmpTeleport) { if (x2 < -border && this.tmpTeleport) {
to.setX(x2 + 1); to.setX(-border + 1);
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
MainUtil.sendMessage(pp, C.BORDER); MainUtil.sendMessage(pp, C.BORDER);
return;
} }
return;
} }
int z2; int z2;
if (MathMan.roundInt(from.getZ()) != (z2 = MathMan.roundInt(to.getZ()))) { if (MathMan.roundInt(from.getZ()) != (z2 = MathMan.roundInt(to.getZ()))) {
@ -834,7 +829,6 @@ import java.util.regex.Pattern;
} }
} else if (now.equals(lastPlot)) { } else if (now.equals(lastPlot)) {
ForceFieldListener.handleForcefield(player, pp, now); ForceFieldListener.handleForcefield(player, pp, now);
return;
} else if (!plotEntry(pp, now) && this.tmpTeleport) { } else if (!plotEntry(pp, now) && this.tmpTeleport) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED);
this.tmpTeleport = false; this.tmpTeleport = false;
@ -848,13 +842,13 @@ import java.util.regex.Pattern;
} }
Integer border = area.getBorder(); Integer border = area.getBorder();
if (z2 > border && this.tmpTeleport) { if (z2 > border && this.tmpTeleport) {
to.setZ(z2 - 1); to.setZ(border - 1);
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;
MainUtil.sendMessage(pp, C.BORDER); MainUtil.sendMessage(pp, C.BORDER);
} else if (z2 < -border && this.tmpTeleport) { } else if (z2 < -border && this.tmpTeleport) {
to.setZ(z2 + 1); to.setZ(-border + 1);
this.tmpTeleport = false; this.tmpTeleport = false;
player.teleport(event.getTo()); player.teleport(event.getTo());
this.tmpTeleport = true; this.tmpTeleport = true;