From ecb1850451b50d59688359618a956b9778104321 Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Sun, 2 Apr 2023 18:04:36 -0400 Subject: [PATCH] Add message for unknown last location for /tpo (#5290) --- .../com/earth2me/essentials/commands/Commandtpoffline.java | 5 +++++ Essentials/src/main/resources/messages.properties | 1 + 2 files changed, 6 insertions(+) diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpoffline.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpoffline.java index 6700ca223..f859b12d4 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpoffline.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandtpoffline.java @@ -21,6 +21,11 @@ public class Commandtpoffline extends EssentialsCommand { final User target = getPlayer(server, args, 0, true, true); final Location logout = target.getLogoutLocation(); + if (logout == null) { + user.sendMessage(tl("teleportOfflineUnknown", user.getDisplayName())); + throw new NoChargeException(); + } + if (user.getWorld() != logout.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + logout.getWorld().getName())) { throw new Exception(tl("noPerm", "essentials.worlds." + logout.getWorld().getName())); } diff --git a/Essentials/src/main/resources/messages.properties b/Essentials/src/main/resources/messages.properties index eab2065c5..e033025ff 100644 --- a/Essentials/src/main/resources/messages.properties +++ b/Essentials/src/main/resources/messages.properties @@ -1268,6 +1268,7 @@ teleportRequestTimeoutInfo=\u00a76This request will timeout after\u00a7c {0} sec teleportTop=\u00a76Teleporting to top. teleportToPlayer=\u00a76Teleporting to \u00a7c{0}\u00a76. teleportOffline=\u00a76The player \u00a7c{0}\u00a76 is currently offline. You are able to teleport to them using /otp. +teleportOfflineUnknown=\u00a76Unable to find the last known position of \u00a7c{0}\u00a76. tempbanExempt=\u00a74You may not tempban that player. tempbanExemptOffline=\u00a74You may not tempban offline players. tempbanJoin=You are banned from this server for {0}. Reason: {1}