Only send border area exit message once (#3418)

Fixes #3335
This commit is contained in:
Jordan 2022-01-05 21:21:37 +01:00 committed by GitHub
parent 9c474570c8
commit 0c76d08b10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -571,7 +571,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied"));
} else {
} else if (MathMan.roundInt(from.getX()) <= border) { // Only send if they just moved out of the border
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
}
} else if (x2 < -border && this.tmpTeleport) {
@ -581,7 +581,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied"));
} else {
} else if (MathMan.roundInt(from.getX()) >= -border) { // Only send if they just moved out of the border
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
}
} else if (((x1 = MathMan.roundInt(from.getX())) >= border && x2 <= border) || (x1 <= -border && x2 >= -border)) {
@ -662,7 +662,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied"));
} else {
} else if (MathMan.roundInt(from.getZ()) <= border) { // Only send if they just moved out of the border
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
}
} else if (z2 < -border && this.tmpTeleport) {
@ -672,7 +672,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
player.teleport(event.getTo());
this.tmpTeleport = true;
pp.sendMessage(TranslatableCaption.of("border.denied"));
} else {
} else if (MathMan.roundInt(from.getZ()) >= -border) { // Only send if they just moved out of the border
pp.sendMessage(TranslatableCaption.of("border.bypass.exited"));
}
} else if (((z1 = MathMan.roundInt(from.getZ())) >= border && z2 <= border) || (z1 <= -border && z2 >= -border)) {