Skip to content

Commit

Permalink
catch permission error
Browse files Browse the repository at this point in the history
  • Loading branch information
AoElite committed Oct 30, 2024
1 parent 60f8812 commit faa471b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main/java/ac/grim/grimac/manager/CheckManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import ac.grim.grimac.player.GrimPlayer;
import ac.grim.grimac.predictionengine.GhostBlockDetector;
import ac.grim.grimac.predictionengine.SneakingEstimator;
import ac.grim.grimac.utils.anticheat.LogUtil;
import ac.grim.grimac.utils.anticheat.update.*;
import ac.grim.grimac.utils.latency.CompensatedCooldown;
import ac.grim.grimac.utils.latency.CompensatedFireworks;
Expand Down Expand Up @@ -333,14 +334,18 @@ public <T extends PostPredictionCheck> T getPostPredictionCheck(Class<T> check)

private void init() {
if (inited) return;

for (AbstractCheck check : allChecks.values()) {
if (check.getCheckName() != null) {
Permission permission = new Permission("grim.exempt." + check.getCheckName().toLowerCase(), PermissionDefault.FALSE);
Bukkit.getPluginManager().addPermission(permission);
String permissionName = "grim.exempt." + check.getCheckName().toLowerCase();
try {
Bukkit.getPluginManager().addPermission(new Permission(permissionName, PermissionDefault.FALSE));
} catch (IllegalArgumentException e) {
LogUtil.error("Failed to add permission \"" + permissionName + "\" for check " + check.getCheckName());
e.printStackTrace();
}
}
}

inited = true;
}

}

0 comments on commit faa471b

Please sign in to comment.