From 7540a6eb70506519750b3eec93c429afc4f6358b Mon Sep 17 00:00:00 2001 From: Luck Date: Fri, 13 Jul 2018 17:51:21 -0700 Subject: [PATCH] Send more appropriate message when no users/groups match the editor type (#1096) --- .../lucko/luckperms/common/commands/misc/EditorCommand.java | 5 +++++ .../me/lucko/luckperms/common/locale/message/Message.java | 1 + 2 files changed, 6 insertions(+) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/EditorCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/EditorCommand.java index a5d5d195..cba61776 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/misc/EditorCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/EditorCommand.java @@ -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)); diff --git a/common/src/main/java/me/lucko/luckperms/common/locale/message/Message.java b/common/src/main/java/me/lucko/luckperms/common/locale/message/Message.java index 17b7e307..9081866e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/locale/message/Message.java +++ b/common/src/main/java/me/lucko/luckperms/common/locale/message/Message.java @@ -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),