[trunk] make user matching a bit less random

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1442 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
ementalo 2011-05-13 21:10:49 +00:00
parent 3eb2022c2c
commit c4099dfb21

View File

@ -32,6 +32,13 @@ public abstract class EssentialsCommand implements IEssentialsCommand
if (args.length <= pos) throw new IndexOutOfBoundsException("§cInvalid command syntax. Did you forget an argument?");
List<Player> matches = server.matchPlayer(args[pos]);
if (matches.size() < 1) throw new NoSuchFieldException("§cNo matching players could be found.");
for (Player p : matches)
{
if (p.getDisplayName().startsWith(args[pos]))
{
return ess.getUser(p);
}
}
return ess.getUser(matches.get(0));
}