Fix regression in /back behavior (#4264)

This commit is contained in:
triagonal 2021-06-23 22:44:47 +10:00 committed by GitHub
parent d4e194fbf7
commit 9bd35a2cd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -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()));

View File

@ -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) {