Update commands to search by UUID

This commit is contained in:
gravitylow 2014-04-16 23:15:14 -04:00
parent bad3d779c5
commit 51ac5d2cb2

View File

@ -131,11 +131,14 @@ public abstract class FCommand extends MCommand<P> {
FPlayer ret = def; FPlayer ret = def;
if (name != null) { if (name != null) {
FPlayer fplayer = FPlayers.i.get(name); OfflinePlayer player = Bukkit.getOfflinePlayer(name);
if (player.getName() != null) {
FPlayer fplayer = FPlayers.i.get(player);
if (fplayer != null) { if (fplayer != null) {
ret = fplayer; ret = fplayer;
} }
} }
}
if (msg && ret == null) { if (msg && ret == null) {
this.msg("<b>No player \"<p>%s<b>\" could be found.", name); this.msg("<b>No player \"<p>%s<b>\" could be found.", name);
@ -158,20 +161,7 @@ public abstract class FCommand extends MCommand<P> {
// BEST FPLAYER MATCH ====================== // BEST FPLAYER MATCH ======================
public FPlayer strAsBestFPlayerMatch(String name, FPlayer def, boolean msg) { public FPlayer strAsBestFPlayerMatch(String name, FPlayer def, boolean msg) {
FPlayer ret = def; return strAsFPlayer(name, def, msg);
if (name != null) {
FPlayer fplayer = FPlayers.i.getBestIdMatch(name);
if (fplayer != null) {
ret = fplayer;
}
}
if (msg && ret == null) {
this.msg("<b>No player match found for \"<p>%s<b>\".", name);
}
return ret;
} }
public FPlayer argAsBestFPlayerMatch(int idx, FPlayer def, boolean msg) { public FPlayer argAsBestFPlayerMatch(int idx, FPlayer def, boolean msg) {