mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-09 08:52:01 +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;
|
foundUser = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foundUser == false)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
throw new NoSuchFieldException(_("playerNotFound"));
|
throw new NoSuchFieldException(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ public class Commandwhois extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
final String whois = args[0].toLowerCase(Locale.ENGLISH);
|
final String whois = args[0].toLowerCase(Locale.ENGLISH);
|
||||||
final int prefixLength = Util.stripFormat(ess.getSettings().getNicknamePrefix()).length();
|
final int prefixLength = Util.stripFormat(ess.getSettings().getNicknamePrefix()).length();
|
||||||
|
Boolean foundUser = false;
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User user = ess.getUser(onlinePlayer);
|
final User user = ess.getUser(onlinePlayer);
|
||||||
@ -52,6 +53,7 @@ public class Commandwhois extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
foundUser = true;
|
||||||
sender.sendMessage("");
|
sender.sendMessage("");
|
||||||
user.setDisplayNick();
|
user.setDisplayNick();
|
||||||
sender.sendMessage(_("whoisIs", user.getDisplayName(), user.getName()));
|
sender.sendMessage(_("whoisIs", user.getDisplayName(), user.getName()));
|
||||||
@ -81,5 +83,9 @@ public class Commandwhois extends EssentialsCommand
|
|||||||
sender.sendMessage(_("whoisGeoLocation", location));
|
sender.sendMessage(_("whoisGeoLocation", location));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!foundUser)
|
||||||
|
{
|
||||||
|
throw new NoSuchFieldException(_("playerNotFound"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user