mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-14 02:24:16 +02: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:
@@ -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?");
|
if (args.length <= pos) throw new IndexOutOfBoundsException("§cInvalid command syntax. Did you forget an argument?");
|
||||||
List<Player> matches = server.matchPlayer(args[pos]);
|
List<Player> matches = server.matchPlayer(args[pos]);
|
||||||
if (matches.size() < 1) throw new NoSuchFieldException("§cNo matching players could be found.");
|
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));
|
return ess.getUser(matches.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user