mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-08-24 23:12:51 +02:00
Add libsdisguises.command.valid.optionstoset
This commit is contained in:
parent
e9a968fe7b
commit
0945fe866c
|
@ -138,9 +138,10 @@ public class DisguisePermissions {
|
|||
|
||||
String disguiseName = split[2];
|
||||
|
||||
DisguisePerm dPerm = DisguiseParser.getDisguisePerm(disguiseName);
|
||||
HashMap<String, Boolean> options = getOptions(permission);
|
||||
|
||||
DisguisePerm dPerm = DisguiseParser.getDisguisePerm(disguiseName);
|
||||
|
||||
// If this refers to a specific disguise
|
||||
if (dPerm != null) {
|
||||
return new ParsedPermission(new DisguisePerm[]{dPerm}, options, (byte) 0, split[1].equals("*"));
|
||||
|
@ -233,7 +234,16 @@ public class DisguisePermissions {
|
|||
|
||||
List<ParsedPermission> list = new ArrayList<>();
|
||||
|
||||
ArrayList<String> valids = new ArrayList<>();
|
||||
|
||||
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());
|
||||
|
||||
if (temp == null) {
|
||||
|
@ -245,6 +255,20 @@ public class DisguisePermissions {
|
|||
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
|
||||
// Negated permissions are last in each inheritance, so false, false, true, true
|
||||
|
||||
|
@ -384,7 +408,7 @@ public class DisguisePermissions {
|
|||
if (disguiseType.isMisc()) {
|
||||
return 3;
|
||||
}
|
||||
} else if (permissionName.equals("custom")) {
|
||||
} else if (permissionName.equals("custom")) {
|
||||
if (disguiseType.isMisc()) {
|
||||
return 3;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user