Fixed disguise options code from not working for all disguises
This commit is contained in:
		| @@ -246,37 +246,27 @@ public class DisguiseParser { | |||||||
|  |  | ||||||
|     private static HashMap<String, Boolean> getDisguiseOptions(CommandSender sender, String permNode, |     private static HashMap<String, Boolean> getDisguiseOptions(CommandSender sender, String permNode, | ||||||
|             DisguisePerm type) { |             DisguisePerm type) { | ||||||
|         switch (type.getType()) { |         HashMap<String, Boolean> returns = new HashMap<>(); | ||||||
|             case PLAYER: |  | ||||||
|             case FALLING_BLOCK: |  | ||||||
|             case PAINTING: |  | ||||||
|             case SPLASH_POTION: |  | ||||||
|             case FISHING_HOOK: |  | ||||||
|             case DROPPED_ITEM: |  | ||||||
|                 HashMap<String, Boolean> returns = new HashMap<>(); |  | ||||||
|  |  | ||||||
|                 String beginning = "libsdisguises.options." + permNode.toLowerCase() + "."; |         String beginning = "libsdisguises.options." + permNode.toLowerCase() + "."; | ||||||
|  |  | ||||||
|                 for (PermissionAttachmentInfo permission : sender.getEffectivePermissions()) { |         for (PermissionAttachmentInfo permission : sender.getEffectivePermissions()) { | ||||||
|                     String lowerPerm = permission.getPermission().toLowerCase(); |             String lowerPerm = permission.getPermission().toLowerCase(); | ||||||
|  |  | ||||||
|                     if (lowerPerm.startsWith(beginning)) { |             if (lowerPerm.startsWith(beginning)) { | ||||||
|                         String[] split = lowerPerm.substring(beginning.length()).split("\\."); |                 String[] split = lowerPerm.substring(beginning.length()).split("\\."); | ||||||
|  |  | ||||||
|                         if (split.length > 1) { |                 if (split.length > 1) { | ||||||
|                             if (split[0].replace("_", "").equals(type.toReadable().toLowerCase().replace(" ", ""))) { |                     if (split[0].replace("_", "").equals(type.toReadable().toLowerCase().replace(" ", ""))) { | ||||||
|                                 for (int i = 1; i < split.length; i++) { |                         for (int i = 1; i < split.length; i++) { | ||||||
|                                     returns.put(split[i], permission.getValue()); |                             returns.put(split[i], permission.getValue()); | ||||||
|                                 } |  | ||||||
|                             } |  | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  |             } | ||||||
|                 return returns; |  | ||||||
|             default: |  | ||||||
|                 return new HashMap<>(); |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         return returns; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static DisguisePerm getDisguisePerm(String name) { |     public static DisguisePerm getDisguisePerm(String name) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user