mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-23 01:27:40 +01:00
[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:
parent
3eb2022c2c
commit
c4099dfb21
@ -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));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user