Skip to content

Commit

Permalink
Merge pull request #1772 from ManInMyVan/fix/perm
Browse files Browse the repository at this point in the history
fix permission default for already defined permissions
  • Loading branch information
AoElite authored Oct 30, 2024
2 parents faa471b + cea13a7 commit 97de474
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/ac/grim/grimac/manager/CheckManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,16 @@ private void init() {
for (AbstractCheck check : allChecks.values()) {
if (check.getCheckName() != null) {
String permissionName = "grim.exempt." + check.getCheckName().toLowerCase();
try {
Permission permission = Bukkit.getPluginManager().getPermission(permissionName);

if (permission == null) {
Bukkit.getPluginManager().addPermission(new Permission(permissionName, PermissionDefault.FALSE));
} catch (IllegalArgumentException e) {
LogUtil.error("Failed to add permission \"" + permissionName + "\" for check " + check.getCheckName());
e.printStackTrace();
} else {
permission.setDefault(PermissionDefault.FALSE);
}
}
}

inited = true;
}

}

0 comments on commit 97de474

Please sign in to comment.