Improved partial name matcher

Fixes #1164
This commit is contained in:
TfT_02
2013-08-19 10:37:04 +02:00
parent 3fe9cfee74
commit 6518d192ec
9 changed files with 83 additions and 17 deletions

View File

@ -15,6 +15,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillUtils;
@ -65,11 +66,12 @@ public abstract class ExperienceCommand implements TabExecutor {
return true;
}
mcMMOPlayer = UserManager.getPlayer(args[0]);
String playerName = Misc.getMatchedPlayerName(args[0]);
McMMOPlayer mcMMOPlayer = UserManager.getPlayerExact(playerName);
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
if (mcMMOPlayer == null) {
profile = mcMMO.getDatabaseManager().loadPlayerProfile(args[0], false);
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false);
if (CommandUtils.unloadedProfile(sender, profile)) {
return true;
@ -84,7 +86,7 @@ public abstract class ExperienceCommand implements TabExecutor {
editValues();
}
handleSenderMessage(sender, args[0]);
handleSenderMessage(sender, playerName);
cleanUp();
return true;