From d23bacb95a5831e5c1cea1a8d53e97ba201d83bb Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Thu, 14 Jun 2018 02:12:56 -0400 Subject: [PATCH] Implement proper deactivation of ignored anticheat checks and temporarily disable KillauraTypeB --- .../src/mineplex/core/antihack/AntiHack.java | 34 +++++++++++-------- .../arcade/game/games/hideseek/HideSeek.java | 6 ++++ .../game/games/minestrike/Minestrike.java | 10 ++++-- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index 90b530283..064f211f2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -1,6 +1,5 @@ package mineplex.core.antihack; -import javax.xml.bind.DatatypeConverter; import java.util.Collections; import java.util.HashSet; import java.util.Map; @@ -10,11 +9,7 @@ import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; -import net.md_5.bungee.api.ChatColor; -import net.md_5.bungee.api.chat.BaseComponent; -import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.ComponentBuilder; -import net.md_5.bungee.api.chat.HoverEvent; +import javax.xml.bind.DatatypeConverter; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -28,11 +23,13 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.plugin.ServicePriority; +import org.bukkit.plugin.java.JavaPlugin; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.google.common.collect.ImmutableMap; import com.google.gson.JsonObject; +import com.mineplex.anticheat.MineplexAnticheat; import com.mineplex.anticheat.api.GameEndEvent; import com.mineplex.anticheat.api.GameStartEvent; import com.mineplex.anticheat.api.MineplexLink; @@ -41,17 +38,14 @@ import com.mineplex.anticheat.checks.Check; import com.mineplex.anticheat.checks.CheckManager; import com.mineplex.anticheat.checks.combat.FastBow; import com.mineplex.anticheat.checks.combat.KillauraTypeA; -import com.mineplex.anticheat.checks.combat.KillauraTypeB; import com.mineplex.anticheat.checks.combat.KillauraTypeC; import com.mineplex.anticheat.checks.combat.KillauraTypeD; import com.mineplex.anticheat.checks.combat.KillauraTypeE; import com.mineplex.anticheat.checks.combat.KillauraTypeF; import com.mineplex.anticheat.checks.move.Glide; import com.mineplex.anticheat.checks.move.HeadRoll; -import com.mineplex.anticheat.checks.move.Phase; import com.mineplex.anticheat.checks.move.Speed; import com.mineplex.anticheat.checks.move.Timer; -import com.mineplex.anticheat.checks.move.Toggle; import com.mineplex.anticheat.checks.player.BadPackets; import com.mineplex.anticheat.checks.player.Scaffold; @@ -91,13 +85,18 @@ import mineplex.core.punish.PunishClient; import mineplex.core.punish.Punishment; import mineplex.core.punish.PunishmentResponse; import mineplex.serverdata.commands.ServerCommandManager; +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; @ReflectivelyCreateMiniPlugin public class AntiHack extends MiniPlugin { public static final Map, CheckThresholds> CHECKS = ImmutableMap., CheckThresholds>builder() .put(KillauraTypeA.class, new CheckThresholds("Kill Aura", 25, 45, 60)) - .put(KillauraTypeB.class, new CheckThresholds("High CPS", 25, 40, 60)) +// .put(KillauraTypeB.class, new CheckThresholds("High CPS", 25, 40, 60)) .put(KillauraTypeC.class, new CheckThresholds("Reach", 35, 80, 120)) .put(KillauraTypeD.class, new CheckThresholds("Kill Aura", 500, 1000, 1500)) .put(KillauraTypeE.class, new CheckThresholds("Kill Aura", 1000, 2000, 5000)) @@ -122,7 +121,7 @@ public class AntiHack extends MiniPlugin public static final Map, AntiHackAction> ACTIONS = ImmutableMap., AntiHackAction>builder() .put(KillauraTypeA.class, new ImmediateBanAction(150)) - .put(KillauraTypeB.class, new BanwaveAction(80)) +// .put(KillauraTypeB.class, new BanwaveAction(80)) .put(KillauraTypeD.class, new BanwaveAction(1500)) .put(KillauraTypeF.class, new BanwaveAction(600)) .put(Glide.class, new ImmediateKickAction(1200)) @@ -179,7 +178,7 @@ public class AntiHack extends MiniPlugin private Set _banned = Collections.synchronizedSet(new HashSet<>()); // These are the GWEN checks to ignore when handling PlayerViolationEvent - private HashSet> _ignoredChecks = new HashSet<>(); + private Set> _ignoredChecks = new HashSet<>(); private boolean _strict; private BanWaveManager _banWaveManager; @@ -527,6 +526,7 @@ public class AntiHack extends MiniPlugin public void addIgnoredCheck(Class check) { _ignoredChecks.add(check); + JavaPlugin.getPlugin(MineplexAnticheat.class).getCheckManager().disableCheck(check); } /** @@ -535,12 +535,18 @@ public class AntiHack extends MiniPlugin */ public void resetIgnoredChecks() { + CheckManager cm = JavaPlugin.getPlugin(MineplexAnticheat.class).getCheckManager(); + if (!cm.getActiveChecks().isEmpty()) + { + _ignoredChecks.forEach(cm::enableCheck); + } _ignoredChecks.clear(); } public void enableAnticheat() { UtilServer.CallEvent(new GameStartEvent()); + _ignoredChecks.forEach(JavaPlugin.getPlugin(MineplexAnticheat.class).getCheckManager()::disableCheck); } public void disableAnticheat() @@ -578,7 +584,7 @@ public class AntiHack extends MiniPlugin .append(" suspected of ", ComponentBuilder.FormatRetention.NONE).color(ChatColor.YELLOW); thresholds.format(componentBuilder, violation.getViolations()); - if (!violation.getOriginatingServer().equals(this._thisServer)) + if (!violation.getOriginatingServer().equals(_thisServer)) { componentBuilder.append(" in ", ComponentBuilder.FormatRetention.NONE).color(ChatColor.YELLOW) .append(violation.getOriginatingServer()).color(ChatColor.AQUA) @@ -608,4 +614,4 @@ public class AntiHack extends MiniPlugin { _strict = strict; } -} +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index a0a26994e..b2736b6cc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -57,7 +57,10 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.util.Vector; +import com.mineplex.anticheat.checks.combat.KillauraTypeA; + import mineplex.core.Managers; +import mineplex.core.antihack.AntiHack; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; @@ -360,6 +363,9 @@ public class HideSeek extends TeamGame .register(this); StrictAntiHack = true; + + AntiHack antiHack = Managers.get(AntiHack.class); + antiHack.addIgnoredCheck(KillauraTypeA.class); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/Minestrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/Minestrike.java index e66399ee6..68556119f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/Minestrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/Minestrike.java @@ -32,6 +32,10 @@ import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Team; import org.bukkit.util.Vector; +import com.mineplex.anticheat.checks.combat.KillauraTypeA; + +import mineplex.core.Managers; +import mineplex.core.antihack.AntiHack; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; @@ -58,7 +62,6 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; - import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -160,10 +163,13 @@ public class Minestrike extends TeamGame this.PlayerGameMode = GameMode.ADVENTURE; + AntiHack antiHack = Managers.get(AntiHack.class); + antiHack.addIgnoredCheck(KillauraTypeA.class); + _scoreObj = Scoreboard.getScoreboard().registerNewObjective("HP", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); - this._help = new String[] + _help = new String[] { //"Tap Crouch when close to an ally to Boost", "Open Inventory at spawn to buy guns",