From 6dd16a545e28627057e3c07565f947768eec14de Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sun, 9 Aug 2020 04:13:13 +1200 Subject: [PATCH] Add permission "themselves" for setName to refer to player command user --- .../disguise/utilities/parser/DisguiseParser.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/utilities/parser/DisguiseParser.java b/src/main/java/me/libraryaddict/disguise/utilities/parser/DisguiseParser.java index 7a44f0b9..7cdc5385 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/parser/DisguiseParser.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/parser/DisguiseParser.java @@ -236,8 +236,7 @@ public class DisguiseParser { if (!Objects.deepEquals(dObj, object)) { throw new IllegalStateException(String.format( "%s has conflicting values in class %s! This means it expected the same value again but " + - "received a " + - "different value on a different disguise! %s is not the same as %s!", + "received a " + "different value on a different disguise! %s is not the same as %s!", setMethod.getName(), setMethod.getDeclaringClass().getName(), object, dObj)); } @@ -710,7 +709,10 @@ public class DisguiseParser { } else { // If they can't use this name, throw error if (!hasPermissionOption(disguiseOptions, "setname", args[1].toLowerCase())) { - throw new DisguiseParseException(LibsMsg.PARSE_NO_PERM_NAME); + if (!args[1].equalsIgnoreCase(sender.getName()) || + !hasPermissionOption(disguiseOptions, "setname", "themselves")) { + throw new DisguiseParseException(LibsMsg.PARSE_NO_PERM_NAME); + } } args[1] = args[1].replace("\\_", " ");