Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- This allows to change between versions and snapshots. -->
<build.version>4.8.1</build.version>
<build.version>4.8.2</build.version>
<build.number>-LOCAL</build.number>
<!-- Sonar Cloud -->
<sonar.projectKey>BentoBoxWorld_Border</sonar.projectKey>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,13 @@ public void onPlayerLeaveIsland(PlayerMoveEvent e) {
if (!addon.getSettings().isReturnTeleport() || !outsideCheck(e.getPlayer(), from, e.getTo())) {
return;
}
BentoBox.getInstance().logDebug("Player " + p.getName() + " is trying to leave the island protection zone.");
// Move the player back inside the border
if (addon.getIslands().getProtectedIslandAt(from).isPresent()) {
BentoBox.getInstance().logDebug("Player " + p.getName() + " is being teleported back inside the island protection zone.");
e.setCancelled(true);
inTeleport.add(p.getUniqueId());
Util.teleportAsync(p, from).thenRun(() -> inTeleport.remove(p.getUniqueId()));
return;
}
BentoBox.getInstance().logDebug("Player " + p.getName() + " is not on an island, trying to find the nearest island to teleport them back to.");
// Backtrack - try to find island at current location, or fall back to the player's own island
Optional<Island> optionalIsland = addon.getIslands().getIslandAt(p.getLocation());
if (optionalIsland.isEmpty()) {
Expand Down Expand Up @@ -348,7 +345,6 @@ public void onPlayerLeaveIsland(PlayerMoveEvent e) {
}
Util.teleportAsync(p, targetPos).thenRun(() -> inTeleport.remove(p.getUniqueId()));
} else {
BentoBox.getInstance().logDebug("Ray trace did not find a valid position for player " + p.getName() + " so teleporting them back to their island home.");
Util.teleportAsync(p, i.getHome("")).thenRun(() -> inTeleport.remove(p.getUniqueId()));
}

Expand Down
Loading