mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-15 11:04:29 +02:00
Make /realname throw an error if no matches were found
This commit is contained in:
@@ -24,6 +24,7 @@ public class Commandrealname extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
final String whois = args[0].toLowerCase(Locale.ENGLISH);
|
final String whois = args[0].toLowerCase(Locale.ENGLISH);
|
||||||
|
boolean foundUser = false;
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User u = ess.getUser(onlinePlayer);
|
final User u = ess.getUser(onlinePlayer);
|
||||||
@@ -39,7 +40,12 @@ public class Commandrealname extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
foundUser = true;
|
||||||
sender.sendMessage(u.getDisplayName() + " " + _("is") + " " + u.getName());
|
sender.sendMessage(u.getDisplayName() + " " + _("is") + " " + u.getName());
|
||||||
}
|
}
|
||||||
|
if (!foundUser)
|
||||||
|
{
|
||||||
|
throw new NoSuchFieldException(_("playerNotFound"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user