1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 04:25:15 +01:00

Double check for permission requirement format being correct

This commit is contained in:
Zrips 2021-09-13 16:44:30 +03:00
parent ee4a323ddf
commit 0100f78c8b
2 changed files with 20 additions and 4 deletions

View File

@ -184,6 +184,8 @@ public class PermissionHandler {
for (Entry<String, Boolean> one : condition.getPerformPerm().entrySet()) {
String perm = one.getKey();
if (perm == null || perm.isEmpty())
continue;
if (one.getValue())
permissions.put(perm, true);
else {

View File

@ -47,7 +47,11 @@ public class JobConditions {
continue;
}
requiresJobs.put(split[0], jobLevel);
String perm = split[0];
if (perm == null || perm.isEmpty())
continue;
requiresJobs.put(perm, jobLevel);
}
if (cond.contains("p:")) {
@ -62,10 +66,20 @@ public class JobConditions {
continue;
String clean = one.substring("p:".length());
String[] split = clean.split("-", 2);
if (split.length > 1) {
performPerm.put(split[0], split[1].equalsIgnoreCase("true"));
if (clean == null || clean.isEmpty())
continue;
String[] split = clean.split("-", 2);
if (split.length > 1) {
String perm = split[0];
if (perm == null || perm.isEmpty())
continue;
boolean value = split[1].equalsIgnoreCase("true");
performPerm.put(perm, value);
} else {
performPerm.put(clean, true);
}