Merge branch '2.9' of github.com:essentials/Essentials into release

This commit is contained in:
KHobbits 2012-10-26 21:41:49 +01:00
commit f0e29552bc
4 changed files with 17 additions and 64 deletions

View File

@ -467,15 +467,21 @@ public class Essentials extends JavaPlugin implements IEssentials
} }
if (base instanceof String) if (base instanceof String)
{ {
final User user = userMap.getUser((String)base); return getOfflineUser((String)base);
if (user != null && user.getBase() instanceof OfflinePlayer)
{
((OfflinePlayer)user.getBase()).setName((String)base);
}
return user;
} }
return null; 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 <T extends Player> User getUser(final T base) private <T extends Player> User getUser(final T base)
{ {
@ -508,17 +514,6 @@ public class Essentials extends JavaPlugin implements IEssentials
return user; 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 @Override
public World getWorld(final String name) public World getWorld(final String name)
{ {

View File

@ -8,7 +8,6 @@ import com.earth2me.essentials.Util;
import java.io.File; import java.io.File;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.entity.Player;
/** /**
@ -72,17 +71,7 @@ public final class Economy
{ {
throw new RuntimeException(noCallBeforeLoad); throw new RuntimeException(noCallBeforeLoad);
} }
User user; return ess.getUser(name);
Player player = ess.getServer().getPlayer(name);
if (player != null)
{
user = ess.getUser(player);
}
else
{
user = ess.getOfflineUser(name);
}
return user;
} }
/** /**

View File

@ -45,16 +45,7 @@ public class Commandmail extends EssentialsCommand
throw new Exception(_("noPerm", "essentials.mail.send")); throw new Exception(_("noPerm", "essentials.mail.send"));
} }
Player player = server.getPlayer(args[1]); User u = ess.getUser(args[0]);
User u;
if (player != null)
{
u = ess.getUser(player);
}
else
{
u = ess.getOfflineUser(args[1]);
}
if (u == null) if (u == null)
{ {
throw new Exception(_("playerNeverOnServer", args[1])); throw new Exception(_("playerNeverOnServer", args[1]));
@ -113,16 +104,7 @@ public class Commandmail extends EssentialsCommand
} }
else if (args.length >= 3 && "send".equalsIgnoreCase(args[0])) else if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
{ {
Player player = server.getPlayer(args[1]); User u = ess.getUser(args[0]);
User u;
if (player != null)
{
u = ess.getUser(player);
}
else
{
u = ess.getOfflineUser(args[1]);
}
if (u == null) if (u == null)
{ {
throw new Exception(_("playerNeverOnServer", args[1])); throw new Exception(_("playerNeverOnServer", args[1]));
@ -138,16 +120,7 @@ public class Commandmail extends EssentialsCommand
else if (args.length >= 2) else if (args.length >= 2)
{ {
//allow sending from console without "send" argument, since it's the only thing the console can do //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 = ess.getUser(args[0]);
User u;
if (player != null)
{
u = ess.getUser(player);
}
else
{
u = ess.getOfflineUser(args[0]);
}
if (u == null) if (u == null)
{ {
throw new Exception(_("playerNeverOnServer", args[0])); throw new Exception(_("playerNeverOnServer", args[0]));

View File

@ -39,11 +39,7 @@ public class Commandsethome extends EssentialsCommand
{ {
if (user.isAuthorized("essentials.sethome.others")) if (user.isAuthorized("essentials.sethome.others"))
{ {
usersHome = ess.getUser(ess.getServer().getPlayer(args[0])); usersHome = ess.getUser(args[0]);
if (usersHome == null)
{
usersHome = ess.getOfflineUser(args[0]);
}
if (usersHome == null) if (usersHome == null)
{ {
throw new NoSuchFieldException(_("playerNotFound")); throw new NoSuchFieldException(_("playerNotFound"));