diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 2419d8209..c1d4e9f74 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -467,15 +467,21 @@ public class Essentials extends JavaPlugin implements IEssentials } if (base instanceof String) { - final User user = userMap.getUser((String)base); - if (user != null && user.getBase() instanceof OfflinePlayer) - { - ((OfflinePlayer)user.getBase()).setName((String)base); - } - return user; + return getOfflineUser((String)base); } return null; } + + @Override + public User getOfflineUser(final String name) + { + final User user = userMap.getUser(name); + if (user != null && user.getBase() instanceof OfflinePlayer) + { + ((OfflinePlayer)user.getBase()).setName(name); + } + return user; + } private User getUser(final T base) { @@ -508,17 +514,6 @@ public class Essentials extends JavaPlugin implements IEssentials return user; } - @Override - public User getOfflineUser(final String name) - { - final User user = userMap.getUser(name); - if (user != null && user.getBase() instanceof OfflinePlayer) - { - ((OfflinePlayer)user.getBase()).setName(name); - } - return user; - } - @Override public World getWorld(final String name) { diff --git a/Essentials/src/com/earth2me/essentials/api/Economy.java b/Essentials/src/com/earth2me/essentials/api/Economy.java index 6ed1829b3..579afd4d1 100644 --- a/Essentials/src/com/earth2me/essentials/api/Economy.java +++ b/Essentials/src/com/earth2me/essentials/api/Economy.java @@ -8,7 +8,6 @@ import com.earth2me.essentials.Util; import java.io.File; import java.util.logging.Level; import java.util.logging.Logger; -import org.bukkit.entity.Player; /** @@ -72,17 +71,7 @@ public final class Economy { throw new RuntimeException(noCallBeforeLoad); } - User user; - Player player = ess.getServer().getPlayer(name); - if (player != null) - { - user = ess.getUser(player); - } - else - { - user = ess.getOfflineUser(name); - } - return user; + return ess.getUser(name); } /** diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java index e2c95afab..66d8ced17 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java @@ -45,16 +45,7 @@ public class Commandmail extends EssentialsCommand throw new Exception(_("noPerm", "essentials.mail.send")); } - Player player = server.getPlayer(args[1]); - User u; - if (player != null) - { - u = ess.getUser(player); - } - else - { - u = ess.getOfflineUser(args[1]); - } + User u = ess.getUser(args[0]); if (u == null) { throw new Exception(_("playerNeverOnServer", args[1])); @@ -113,16 +104,7 @@ public class Commandmail extends EssentialsCommand } else if (args.length >= 3 && "send".equalsIgnoreCase(args[0])) { - Player player = server.getPlayer(args[1]); - User u; - if (player != null) - { - u = ess.getUser(player); - } - else - { - u = ess.getOfflineUser(args[1]); - } + User u = ess.getUser(args[0]); if (u == null) { throw new Exception(_("playerNeverOnServer", args[1])); @@ -138,16 +120,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 - Player player = server.getPlayer(args[0]); - User u; - if (player != null) - { - u = ess.getUser(player); - } - else - { - u = ess.getOfflineUser(args[0]); - } + User u = ess.getUser(args[0]); if (u == null) { throw new Exception(_("playerNeverOnServer", args[0])); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java index eb151077f..1e27e7e3b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java @@ -39,11 +39,7 @@ public class Commandsethome extends EssentialsCommand { if (user.isAuthorized("essentials.sethome.others")) { - usersHome = ess.getUser(ess.getServer().getPlayer(args[0])); - if (usersHome == null) - { - usersHome = ess.getOfflineUser(args[0]); - } + usersHome = ess.getUser(args[0]); if (usersHome == null) { throw new NoSuchFieldException(_("playerNotFound"));