implements CommandCaller, OfflinePlotPlayer, @NotNull public Location getLocation() { Location location = getMeta("location"); if (location != null) { - return location; + return location.copy(); // Always return a copy of the location } return getLocationFull(); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/Plot.java b/Core/src/main/java/com/plotsquared/core/plot/Plot.java index 46ce9f24c..2adca5334 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java @@ -3010,11 +3010,9 @@ public class Plot { final String name = player.getName(); TaskManager.TELEPORT_QUEUE.add(name); TaskManager.runTaskLater(() -> { - if (!TaskManager.TELEPORT_QUEUE.contains(name)) { - MainUtil.sendMessage(player, Captions.TELEPORT_FAILED); + if (!TaskManager.TELEPORT_QUEUE.remove(name)) { return; } - TaskManager.TELEPORT_QUEUE.remove(name); if (player.isOnline()) { MainUtil.sendMessage(player, Captions.TELEPORTED_TO_PLOT); player.teleport(location, cause); diff --git a/Core/src/main/java/com/plotsquared/core/util/MainUtil.java b/Core/src/main/java/com/plotsquared/core/util/MainUtil.java index d5c2dbce7..332e09791 100644 --- a/Core/src/main/java/com/plotsquared/core/util/MainUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/MainUtil.java @@ -372,10 +372,21 @@ public class MainUtil { /** * Get the name from a UUID. * - * @param owner + * @param owner Owner UUID * @return The player's name, None, Everyone or Unknown */ - @NotNull public static String getName(UUID owner) { + @NotNull public static String getName(@Nullable UUID owner) { + return getName(owner, true); + } + + /** + * Get the name from a UUID. + * + * @param owner Owner UUID + * @param blocking Whether or not the operation can be blocking + * @return The player's name, None, Everyone or Unknown + */ + @NotNull public static String getName(@Nullable final UUID owner, final boolean blocking) { if (owner == null) { return Captions.NONE.getTranslated(); } @@ -385,7 +396,17 @@ public class MainUtil { if (owner.equals(DBFunc.SERVER)) { return Captions.SERVER.getTranslated(); } - String name = PlotSquared.get().getImpromptuUUIDPipeline().getSingle(owner, Settings.UUID.BLOCKING_TIMEOUT); + final String name; + if (blocking) { + name = PlotSquared.get().getImpromptuUUIDPipeline().getSingle(owner, Settings.UUID.BLOCKING_TIMEOUT); + } else { + final UUIDMapping uuidMapping = PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(owner); + if (uuidMapping != null) { + name = uuidMapping.getUsername(); + } else { + name = null; + } + } if (name == null) { return Captions.UNKNOWN.getTranslated(); } diff --git a/build.gradle b/build.gradle index a841bb030..a0bae9c0c 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ ext { git = Grgit.open(dir: new File(rootDir.toString() + "/.git")) } -def ver = "5.12.3" +def ver = "5.12.5" def versuffix = "" ext { if (project.hasProperty("versionsuffix")) {