diff --git a/Essentials/src/main/java/com/earth2me/essentials/AsyncTeleport.java b/Essentials/src/main/java/com/earth2me/essentials/AsyncTeleport.java index 12d5eb23b..1befe4ecb 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/AsyncTeleport.java +++ b/Essentials/src/main/java/com/earth2me/essentials/AsyncTeleport.java @@ -163,7 +163,6 @@ public class AsyncTeleport implements IAsyncTeleport { future.complete(false); return; } - teleportee.setLastLocation(); if (!ess.getSettings().isForcePassengerTeleport() && !teleportee.getBase().isEmpty()) { if (!ess.getSettings().isTeleportPassengerDismount()) { @@ -178,7 +177,11 @@ public class AsyncTeleport implements IAsyncTeleport { return; } } - teleportee.setLastLocation(); + + if (teleportee.isAuthorized("essentials.back.onteleport")) { + teleportee.setLastLocation(); + } + final Location targetLoc = target.getLocation(); if (ess.getSettings().isTeleportSafetyEnabled() && LocationUtil.isBlockOutsideWorldBorder(targetLoc.getWorld(), targetLoc.getBlockX(), targetLoc.getBlockZ())) { targetLoc.setX(LocationUtil.getXInsideWorldBorder(targetLoc.getWorld(), targetLoc.getBlockX())); diff --git a/Essentials/src/main/java/com/earth2me/essentials/UserData.java b/Essentials/src/main/java/com/earth2me/essentials/UserData.java index f6ebd70f9..46834a183 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/UserData.java +++ b/Essentials/src/main/java/com/earth2me/essentials/UserData.java @@ -262,7 +262,8 @@ public abstract class UserData extends PlayerExtension implements IConf { } public Location getLastLocation() { - return holder.lastLocation().location(); + final LazyLocation lastLocation = holder.lastLocation(); + return lastLocation != null ? lastLocation.location() : null; } public void setLastLocation(final Location loc) {