Make commands guess players by nickname

This commit is contained in:
Jerom van der Sar 2012-11-21 16:48:23 +01:00
parent a1047b1811
commit a696a8b23b

View File

@ -36,6 +36,13 @@ public class TFM_Command
List<Player> matches = server.matchPlayer(partialname); List<Player> matches = server.matchPlayer(partialname);
if (matches.isEmpty()) if (matches.isEmpty())
{ {
for(Player p : server.getOnlinePlayers())
{
if(p.getDisplayName().toLowerCase().indexOf(partialname) != -1)
{
return p;
}
}
throw new CantFindPlayerException(partialname); throw new CantFindPlayerException(partialname);
} }
else else