Skip to content

Commit

Permalink
Support Negativity Anti Cheat
Browse files Browse the repository at this point in the history
  • Loading branch information
2008Choco committed Aug 27, 2024
1 parent 2da584e commit 5b61abf
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ anticheat-matrix = "317d4635fd" # This repository is dead now, but we're going t
anticheat-nocheatplus = "3.16.1-SNAPSHOT"
anticheat-spartan = "1.0"
anticheat-light = "99d1930f2a" # https://github.com/tiredvekster/LightAntiCheat/commit/99d1930f2afa0e5dd23a5e212aadf49499e3fd83
anticheat-negativity = "2.7.1"
bstats = "3.0.2"
mcmmo = "2.1.228"
placeholder-api = "2.11.5"
Expand Down Expand Up @@ -44,6 +45,7 @@ anticheat-matrix = { module = "com.github.jiangdashao:matrix-api-repo", version.
anticheat-nocheatplus = { module = "fr.neatmonster:nocheatplus", version.ref = "anticheat-nocheatplus" }
anticheat-spartan = { module = "me.vagdedes:SpartanAPI", version.ref = "anticheat-spartan" }
anticheat-light = { module = "com.github.tiredvekster:LightAntiCheat", version.ref = "anticheat-light" }
anticheat-negativity = { module = "com.github.Elikill58:Negativity", version.ref = "anticheat-negativity" }
bstats-base = { module = "org.bstats:bstats-base", version.ref = "bstats" }
bstats-bukkit = { module = "org.bstats:bstats-bukkit", version.ref = "bstats" }
choco-networking-bukkit = { module = "wtf.choco:networking-bukkit", version.ref = "choco-networking" }
Expand Down
1 change: 1 addition & 0 deletions veinminer-bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies {
compileOnly(libs.anticheat.nocheatplus)
compileOnly(libs.anticheat.spartan)
compileOnly(libs.anticheat.light)
compileOnly(libs.anticheat.negativity)

testImplementation(libs.junit.jupiter.api)
testRuntimeOnly(libs.junit.jupiter.engine)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import wtf.choco.veinminer.anticheat.AntiCheatHookLightAntiCheat;
import wtf.choco.veinminer.anticheat.AntiCheatHookMatrix;
import wtf.choco.veinminer.anticheat.AntiCheatHookNCP;
import wtf.choco.veinminer.anticheat.AntiCheatHookNegativity;
import wtf.choco.veinminer.anticheat.AntiCheatHookSpartan;
import wtf.choco.veinminer.command.CommandBlocklist;
import wtf.choco.veinminer.command.CommandToollist;
Expand Down Expand Up @@ -162,6 +163,7 @@ public void onEnable() {
this.registerAntiCheatHookIfEnabled(manager, "GrimAC", () -> new AntiCheatHookGrim(this));
this.registerAntiCheatHookIfEnabled(manager, "LightAntiCheat", AntiCheatHookLightAntiCheat::new);
this.registerAntiCheatHookIfEnabled(manager, "Matrix", AntiCheatHookMatrix::new);
this.registerAntiCheatHookIfEnabled(manager, "Negativity", AntiCheatHookNegativity::new);
this.registerAntiCheatHookIfEnabled(manager, "NoCheatPlus", () -> new AntiCheatHookNCP(this));
this.registerAntiCheatHookIfEnabled(manager, "Spartan", () -> new AntiCheatHookSpartan(this));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package wtf.choco.veinminer.anticheat;

import com.elikill58.negativity.universal.bypass.BypassManager;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

public final class AntiCheatHookNegativity implements AntiCheatHook {

private final Set<UUID> exempt = new HashSet<>();

public AntiCheatHookNegativity() {
BypassManager.addBypassChecker((player, cheat) -> exempt.contains(player.getUniqueId()));
}

@Override
public void exempt(@NotNull Player player) {
this.exempt.add(player.getUniqueId());
}

@Override
public void unexempt(@NotNull Player player) {
this.exempt.remove(player.getUniqueId());
}

@Override
public boolean shouldUnexempt(@NotNull Player player) {
return exempt.contains(player.getUniqueId());
}

}
1 change: 1 addition & 0 deletions veinminer-bukkit/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ softdepend:
- GrimAC
- LightAntiCheat
- Matrix
- Negativity
- NoCheatPlus
- Spartan
# others
Expand Down

0 comments on commit 5b61abf

Please sign in to comment.