mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-08 03:50:06 +01:00
Make /whois throw an error if no matching players are found.
This commit is contained in:
parent
77b0415c1b
commit
2e15de483d
@ -42,7 +42,7 @@ public class Commandpay extends EssentialsCommand
|
||||
foundUser = true;
|
||||
}
|
||||
|
||||
if (foundUser == false)
|
||||
if (!foundUser)
|
||||
{
|
||||
throw new NoSuchFieldException(_("playerNotFound"));
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public class Commandwhois extends EssentialsCommand
|
||||
}
|
||||
final String whois = args[0].toLowerCase(Locale.ENGLISH);
|
||||
final int prefixLength = Util.stripFormat(ess.getSettings().getNicknamePrefix()).length();
|
||||
Boolean foundUser = false;
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
final User user = ess.getUser(onlinePlayer);
|
||||
@ -52,6 +53,7 @@ public class Commandwhois extends EssentialsCommand
|
||||
{
|
||||
continue;
|
||||
}
|
||||
foundUser = true;
|
||||
sender.sendMessage("");
|
||||
user.setDisplayNick();
|
||||
sender.sendMessage(_("whoisIs", user.getDisplayName(), user.getName()));
|
||||
@ -81,5 +83,9 @@ public class Commandwhois extends EssentialsCommand
|
||||
sender.sendMessage(_("whoisGeoLocation", location));
|
||||
}
|
||||
}
|
||||
if (!foundUser)
|
||||
{
|
||||
throw new NoSuchFieldException(_("playerNotFound"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user