From 3ae9956df9b0fa55955ce890724d544214a6777c Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Sun, 24 Mar 2013 16:53:01 +0100 Subject: [PATCH] Actually fix partial name matching when using `/mcrank` Fixes #878 --- .../nossr50/commands/player/McrankCommand.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/player/McrankCommand.java b/src/main/java/com/gmail/nossr50/commands/player/McrankCommand.java index 760afc788..eced770a1 100644 --- a/src/main/java/com/gmail/nossr50/commands/player/McrankCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/player/McrankCommand.java @@ -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;