From f7f551caa84426431007c56db2a425a5b5a41a76 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Wed, 22 Jan 2020 19:28:12 +1300 Subject: [PATCH] Fixed disguise options code from not working for all disguises --- .../utilities/parser/DisguiseParser.java | 36 +++++++------------ 1 file changed, 13 insertions(+), 23 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 5f39b9b1..a8d6b7ca 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/parser/DisguiseParser.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/parser/DisguiseParser.java @@ -246,37 +246,27 @@ public class DisguiseParser { private static HashMap getDisguiseOptions(CommandSender sender, String permNode, DisguisePerm type) { - switch (type.getType()) { - case PLAYER: - case FALLING_BLOCK: - case PAINTING: - case SPLASH_POTION: - case FISHING_HOOK: - case DROPPED_ITEM: - HashMap returns = new HashMap<>(); + HashMap returns = new HashMap<>(); - String beginning = "libsdisguises.options." + permNode.toLowerCase() + "."; + String beginning = "libsdisguises.options." + permNode.toLowerCase() + "."; - for (PermissionAttachmentInfo permission : sender.getEffectivePermissions()) { - String lowerPerm = permission.getPermission().toLowerCase(); + for (PermissionAttachmentInfo permission : sender.getEffectivePermissions()) { + String lowerPerm = permission.getPermission().toLowerCase(); - if (lowerPerm.startsWith(beginning)) { - String[] split = lowerPerm.substring(beginning.length()).split("\\."); + if (lowerPerm.startsWith(beginning)) { + String[] split = lowerPerm.substring(beginning.length()).split("\\."); - if (split.length > 1) { - if (split[0].replace("_", "").equals(type.toReadable().toLowerCase().replace(" ", ""))) { - for (int i = 1; i < split.length; i++) { - returns.put(split[i], permission.getValue()); - } - } + if (split.length > 1) { + if (split[0].replace("_", "").equals(type.toReadable().toLowerCase().replace(" ", ""))) { + for (int i = 1; i < split.length; i++) { + returns.put(split[i], permission.getValue()); } } } - - return returns; - default: - return new HashMap<>(); + } } + + return returns; } public static DisguisePerm getDisguisePerm(String name) {