Add ignored checks to GWEN (#211)
This commit is contained in:
parent
e15804fc15
commit
a3d210871d
@ -8,6 +8,7 @@ import com.mineplex.anticheat.api.GameEndEvent;
|
||||
import com.mineplex.anticheat.api.GameStartEvent;
|
||||
import com.mineplex.anticheat.api.MineplexLink;
|
||||
import com.mineplex.anticheat.api.PlayerViolationEvent;
|
||||
import com.mineplex.anticheat.checks.Check;
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.PlayerSelector;
|
||||
@ -144,6 +145,9 @@ public class AntiHack extends MiniPlugin
|
||||
|
||||
private Set<Player> _pendingBan = new HashSet<>();
|
||||
|
||||
// These are the GWEN checks to ignore when handling PlayerViolationEvent
|
||||
private HashSet<Class<? extends Check>> _ignoredChecks = new HashSet<>();
|
||||
|
||||
@SuppressWarnings("Convert2streamapi")
|
||||
private AntiHack()
|
||||
{
|
||||
@ -654,6 +658,9 @@ public class AntiHack extends MiniPlugin
|
||||
@EventHandler
|
||||
public void on(PlayerViolationEvent event)
|
||||
{
|
||||
if (_ignoredChecks.contains(event.getCheckClass()))
|
||||
return;
|
||||
|
||||
AntiHackAction.getAction(event.getCheckClass()).handle(event);
|
||||
}
|
||||
|
||||
@ -993,6 +1000,9 @@ public class AntiHack extends MiniPlugin
|
||||
@EventHandler
|
||||
public void onHack(PlayerViolationEvent event)
|
||||
{
|
||||
if (_ignoredChecks.contains(event.getCheckClass()))
|
||||
return;
|
||||
|
||||
if (event.shouldTellStaff())
|
||||
{
|
||||
CheckThresholds thresholds = CHECKS.get(event.getHackType());
|
||||
@ -1158,6 +1168,25 @@ public class AntiHack extends MiniPlugin
|
||||
System.out.println("MAC Strict: " + strict);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a GWEN Anticheat class to the ignored checks.
|
||||
* All violation events for these checks will be ignored
|
||||
* @param check The class of the check to ignore
|
||||
*/
|
||||
public void addIgnoredCheck(Class<? extends Check> check)
|
||||
{
|
||||
_ignoredChecks.add(check);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the set of ignored checks. In the case that checks are being ignored for a specific game,
|
||||
* this should be called when the game finishes.
|
||||
*/
|
||||
public void resetIgnoredChecks()
|
||||
{
|
||||
_ignoredChecks.clear();
|
||||
}
|
||||
|
||||
public boolean isStrict()
|
||||
{
|
||||
return _strict;
|
||||
|
@ -2221,6 +2221,7 @@ public abstract class Game implements Listener
|
||||
|
||||
public void disable()
|
||||
{
|
||||
Managers.get(AntiHack.class).resetIgnoredChecks();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -8,6 +8,11 @@ import java.util.Iterator;
|
||||
import java.util.TreeMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.mineplex.anticheat.checks.move.Glide;
|
||||
import com.mineplex.anticheat.checks.move.HeadRoll;
|
||||
import com.mineplex.anticheat.checks.move.Speed;
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
@ -178,6 +183,12 @@ public class Skyfall extends SoloGame
|
||||
|
||||
registerModule(new VersionModule(MinecraftVersion.Version1_9, "Skyfall requires Minecraft 1.9!"));
|
||||
|
||||
// Disable specific GWEN checks for this game
|
||||
AntiHack antiHack = Managers.get(AntiHack.class);
|
||||
antiHack.addIgnoredCheck(Speed.class);
|
||||
antiHack.addIgnoredCheck(Glide.class);
|
||||
antiHack.addIgnoredCheck(HeadRoll.class);
|
||||
|
||||
_islands = new HashMap<>();
|
||||
_boosterRings = new ArrayList<>();
|
||||
_tntMap = new HashMap<>();
|
||||
|
Loading…
Reference in New Issue
Block a user