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;
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) {
ret = fplayer;
}
}
}
if (msg && ret == null) {
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 ======================
public FPlayer strAsBestFPlayerMatch(String name, FPlayer def, boolean msg) {
FPlayer ret = def;
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;
return strAsFPlayer(name, def, msg);
}
public FPlayer argAsBestFPlayerMatch(int idx, FPlayer def, boolean msg) {