Add libsdisguises.command.valid.optionstoset
This commit is contained in:
		| @@ -138,9 +138,10 @@ public class DisguisePermissions { | |||||||
|  |  | ||||||
|         String disguiseName = split[2]; |         String disguiseName = split[2]; | ||||||
|  |  | ||||||
|         DisguisePerm dPerm = DisguiseParser.getDisguisePerm(disguiseName); |  | ||||||
|         HashMap<String, Boolean> options = getOptions(permission); |         HashMap<String, Boolean> options = getOptions(permission); | ||||||
|  |  | ||||||
|  |         DisguisePerm dPerm = DisguiseParser.getDisguisePerm(disguiseName); | ||||||
|  |  | ||||||
|         // If this refers to a specific disguise |         // If this refers to a specific disguise | ||||||
|         if (dPerm != null) { |         if (dPerm != null) { | ||||||
|             return new ParsedPermission(new DisguisePerm[]{dPerm}, options, (byte) 0, split[1].equals("*")); |             return new ParsedPermission(new DisguisePerm[]{dPerm}, options, (byte) 0, split[1].equals("*")); | ||||||
| @@ -233,7 +234,16 @@ public class DisguisePermissions { | |||||||
|  |  | ||||||
|         List<ParsedPermission> list = new ArrayList<>(); |         List<ParsedPermission> list = new ArrayList<>(); | ||||||
|  |  | ||||||
|  |         ArrayList<String> valids = new ArrayList<>(); | ||||||
|  |  | ||||||
|         for (Map.Entry<String, Boolean> entry : permissions.entrySet()) { |         for (Map.Entry<String, Boolean> entry : permissions.entrySet()) { | ||||||
|  |             String key = entry.getKey(); | ||||||
|  |  | ||||||
|  |             if (key.split("\\.").length > 2 && key.split("\\.")[2].equalsIgnoreCase("valid")) { | ||||||
|  |                 valids.add(key); | ||||||
|  |                 continue; | ||||||
|  |             } | ||||||
|  |  | ||||||
|             ParsedPermission temp = parsePermission(entry.getKey()); |             ParsedPermission temp = parsePermission(entry.getKey()); | ||||||
|  |  | ||||||
|             if (temp == null) { |             if (temp == null) { | ||||||
| @@ -245,6 +255,20 @@ public class DisguisePermissions { | |||||||
|             list.add(temp); |             list.add(temp); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         for (String valid : valids) { | ||||||
|  |             HashMap<String, Boolean> options = getOptions(valid); | ||||||
|  |  | ||||||
|  |             String key = valid.split("\\.")[1]; | ||||||
|  |  | ||||||
|  |             if (!key.equals("*") && !key.equalsIgnoreCase(commandName)){ | ||||||
|  |                 continue; | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             for (ParsedPermission perms : list) { | ||||||
|  |                 perms.options.putAll(options); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|         // Sorted from 5 to 0 where "*" is first and "Cow" is last |         // Sorted from 5 to 0 where "*" is first and "Cow" is last | ||||||
|         // Negated permissions are last in each inheritance, so false, false, true, true |         // Negated permissions are last in each inheritance, so false, false, true, true | ||||||
|  |  | ||||||
| @@ -384,7 +408,7 @@ public class DisguisePermissions { | |||||||
|             if (disguiseType.isMisc()) { |             if (disguiseType.isMisc()) { | ||||||
|                 return 3; |                 return 3; | ||||||
|             } |             } | ||||||
|         }  else if (permissionName.equals("custom")) { |         } else if (permissionName.equals("custom")) { | ||||||
|             if (disguiseType.isMisc()) { |             if (disguiseType.isMisc()) { | ||||||
|                 return 3; |                 return 3; | ||||||
|             } |             } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user