From cbaf126a255e9ee43f08d4dad9db5e703c3c767c Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 17 May 2014 02:44:37 +0100 Subject: [PATCH] Stop using old string player lookup. --- Essentials/src/com/earth2me/essentials/User.java | 7 ++++--- .../src/com/earth2me/essentials/commands/Commandmail.java | 8 ++++---- .../com/earth2me/essentials/commands/Commandsethome.java | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 0146da74a..8ca3e18cc 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -10,6 +10,7 @@ import com.earth2me.essentials.utils.NumberUtil; import java.math.BigDecimal; import java.util.Calendar; import java.util.GregorianCalendar; +import java.util.UUID; import java.util.logging.Level; import java.util.logging.Logger; import net.ess3.api.IEssentials; @@ -28,7 +29,7 @@ public class User extends UserData implements Comparable, IReplyTo, net.es { private static final Logger logger = Logger.getLogger("Essentials"); private CommandSource replyTo = null; - private transient String teleportRequester; + private transient UUID teleportRequester; private transient boolean teleportRequestHere; private transient Location teleportLocation; private transient boolean vanished; @@ -265,7 +266,7 @@ public class User extends UserData implements Comparable, IReplyTo, net.es public void requestTeleport(final User player, final boolean here) { teleportRequestTime = System.currentTimeMillis(); - teleportRequester = player == null ? null : player.getName(); + teleportRequester = player == null ? null : player.getBase().getUniqueId(); teleportRequestHere = here; if (player == null) { @@ -277,7 +278,7 @@ public class User extends UserData implements Comparable, IReplyTo, net.es } } - public String getTeleportRequest() + public UUID getTeleportRequest() { return teleportRequester; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java index 0b7a5a09d..70ea2f5d9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java @@ -47,13 +47,13 @@ public class Commandmail extends EssentialsCommand { throw new Exception(tl("noPerm", "essentials.mail.send")); } - + if (user.isMuted()) { throw new Exception(tl("voiceSilenced")); } - User u = ess.getUser(args[1]); + User u = getPlayer(server, args[1], true, true); if (u == null) { throw new Exception(tl("playerNeverOnServer", args[1])); @@ -112,7 +112,7 @@ public class Commandmail extends EssentialsCommand } else if (args.length >= 3 && "send".equalsIgnoreCase(args[0])) { - User u = ess.getUser(args[1]); + User u = getPlayer(server, args[1], true, true); if (u == null) { throw new Exception(tl("playerNeverOnServer", args[1])); @@ -130,7 +130,7 @@ public class Commandmail extends EssentialsCommand else if (args.length >= 2) { //allow sending from console without "send" argument, since it's the only thing the console can do - User u = ess.getUser(args[0]); + User u = getPlayer(server, args[0], true, true); if (u == null) { throw new Exception(tl("playerNeverOnServer", args[0])); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java index 15f10e786..6a432d660 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java @@ -40,7 +40,7 @@ public class Commandsethome extends EssentialsCommand name = args[1].toLowerCase(Locale.ENGLISH); if (user.isAuthorized("essentials.sethome.others")) { - usersHome = ess.getUser(args[0]); + usersHome = getPlayer(server, args[0], true, true); if (usersHome == null) { throw new PlayerNotFoundException();