Actually fix partial name matching when using /mcrank

Fixes #878
This commit is contained in:
TfT_02 2013-03-24 16:53:01 +01:00
parent 78109eb499
commit 3ae9956df9

View File

@ -46,22 +46,25 @@ public class McrankCommand implements CommandExecutor {
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(args[0]);
String playerName = args[0];
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName);
if (mcMMOPlayer == null) {
if (CommandUtils.inspectOffline(sender, new PlayerProfile(args[0], false), Permissions.mcrankOffline(sender))) {
if (mcMMOPlayer != null) {
playerName = mcMMOPlayer.getPlayer().getName();
if (CommandUtils.tooFar(sender, mcMMOPlayer.getPlayer(), Permissions.mcrankFar(sender))) {
return true;
}
}
else if (CommandUtils.tooFar(sender, mcMMOPlayer.getPlayer(), Permissions.mcrankFar(sender))) {
} else if (CommandUtils.inspectOffline(sender, new PlayerProfile(playerName, false), Permissions.mcrankOffline(sender))) {
return true;
}
if (Config.getInstance().getUseMySQL()) {
sqlDisplay(sender, args[0]);
sqlDisplay(sender, playerName);
}
else {
flatfileDisplay(sender, args[0]);
flatfileDisplay(sender, playerName);
}
return true;