Send more appropriate message when no users/groups match the editor type (#1096)

This commit is contained in:
Luck 2018-07-13 17:51:21 -07:00
parent fa2d9357b8
commit 7540a6eb70
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 6 additions and 0 deletions

View File

@ -87,6 +87,11 @@ public class EditorCommand extends SingleCommand {
.forEach(holders::add);
}
if (holders.isEmpty()) {
Message.EDITOR_NO_MATCH.send(sender);
return CommandResult.STATE_ERROR;
}
// remove holders which the sender doesn't have perms to view
holders.removeIf(holder -> ArgumentPermissions.checkViewPerms(plugin, sender, getPermission().get(), holder));

View File

@ -158,6 +158,7 @@ public enum Message {
APPLY_EDITS_DIFF_ADDED("&a+ &f{}", false),
APPLY_EDITS_DIFF_REMOVED("&c- &f{}", false),
EDITOR_NO_MATCH("&cUnable to open editor. No objects matched the desired type.", true),
EDITOR_START("&7Preparing a new editor session. Please wait...", true),
EDITOR_UPLOAD_FAILURE("&cUnable to upload permission data to the editor.", true),
EDITOR_URL("&aClick the link below to open the editor:", true),