1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-13 18:14:38 +02:00

Make /realname throw an error if no matches were found

This commit is contained in:
KHobbits
2012-09-11 00:53:32 +01:00
parent 7497d94359
commit ce55da8a2a

View File

@@ -24,6 +24,7 @@ public class Commandrealname extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
final String whois = args[0].toLowerCase(Locale.ENGLISH);
boolean foundUser = false;
for (Player onlinePlayer : server.getOnlinePlayers())
{
final User u = ess.getUser(onlinePlayer);
@@ -39,7 +40,12 @@ public class Commandrealname extends EssentialsCommand
{
continue;
}
foundUser = true;
sender.sendMessage(u.getDisplayName() + " " + _("is") + " " + u.getName());
}
if (!foundUser)
{
throw new NoSuchFieldException(_("playerNotFound"));
}
}
}