From 6170d8e77f03ff5c048c6ae7db0f3d3898485222 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Wed, 6 May 2020 13:07:11 +1200 Subject: [PATCH] Fixed an error with null item --- .../disguise/utilities/parser/DisguiseParser.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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 764c1e10..54dc91b7 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/parser/DisguiseParser.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/parser/DisguiseParser.java @@ -626,7 +626,7 @@ public class DisguiseParser { disguisePerm = new DisguisePerm(disguise.getType()); name = disguise.getDisguiseName(); - customName = disguise.isCustomName(); + customName = disguise.isCustomDisguiseName(); if (disguisePerm.isUnknown()) { throw new DisguiseParseException(LibsMsg.PARSE_CANT_DISG_UNKNOWN); @@ -757,11 +757,11 @@ public class DisguiseParser { usedOptions.add(optionName); doCheck(sender, permissions, disguisePerm, usedOptions); + String itemName = itemStack == null ? "null" : itemStack.getType().name().toLowerCase(); - if (!hasPermissionOption(disguiseOptions, optionName, - itemStack.getType().name().toLowerCase())) { - throw new DisguiseParseException(LibsMsg.PARSE_NO_PERM_PARAM, - itemStack.getType().name(), disguisePerm.toReadable()); + if (!hasPermissionOption(disguiseOptions, optionName, itemName)) { + throw new DisguiseParseException(LibsMsg.PARSE_NO_PERM_PARAM, itemName, + disguisePerm.toReadable()); } toSkip++; @@ -812,7 +812,7 @@ public class DisguiseParser { } disguise.setDisguiseName(name); - disguise.setCustomName(customName); + disguise.setCustomDisguiseName(customName); // Copy strings to their new range String[] newArgs = new String[args.length - toSkip];