Skip to content

Commit

Permalink
Merge pull request #1684 from ManInMyVan/exempt-specific-checks
Browse files Browse the repository at this point in the history
allow exempting for specific checks
  • Loading branch information
AoElite authored Aug 30, 2024
2 parents b3d780b + af60e07 commit 7add2b6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/ac/grim/grimac/checks/Check.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class Check implements AbstractCheck {
private boolean experimental;
@Setter
private boolean isEnabled;
private boolean exempted;

@Override
public boolean isExperimental() {
Expand Down Expand Up @@ -56,7 +57,7 @@ public Check(final GrimPlayer player) {
}

public boolean shouldModifyPackets() {
return isEnabled && !player.disableGrim && !player.noModifyPacketPermission;
return isEnabled && !player.disableGrim && !player.noModifyPacketPermission && !exempted;
}

public final boolean flagAndAlert(String verbose) {
Expand All @@ -72,7 +73,7 @@ public final boolean flagAndAlert() {
}

public final boolean flag() {
if (player.disableGrim || (experimental && !GrimAPI.INSTANCE.getConfigManager().isExperimentalChecks()))
if (player.disableGrim || (experimental && !GrimAPI.INSTANCE.getConfigManager().isExperimentalChecks()) || exempted)
return false; // Avoid calling event if disabled

FlagEvent event = new FlagEvent(player, this);
Expand Down Expand Up @@ -103,6 +104,8 @@ public void reload() {
setbackVL = getConfig().getDoubleElse(configName + ".setbackvl", setbackVL);

if (setbackVL == -1) setbackVL = Double.MAX_VALUE;

exempted = player.bukkitPlayer != null && player.bukkitPlayer.hasPermission("grim.exempt." + checkName.toLowerCase());
}

public boolean alert(String verbose) {
Expand Down

0 comments on commit 7add2b6

Please sign in to comment.