From 9be26a92d1e3f5c6f8f5b3c2e08036e6d645ace3 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 21 Sep 2016 22:21:49 -0400 Subject: [PATCH] Remove NCP --- Plugins/Mineplex.Core/pom.xml | 4 - .../src/mineplex/core/CustomTagFix.java | 134 +----------------- .../src/mineplex/core/NCPDataManFix.java | 10 -- Plugins/Nautilus.Game.Arcade/pom.xml | 4 - .../arcade/game/games/skyfall/Skyfall.java | 13 -- .../game/arcade/game/games/uhc/UHC.java | 32 +---- Plugins/pom.xml | 6 - 7 files changed, 2 insertions(+), 201 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/NCPDataManFix.java diff --git a/Plugins/Mineplex.Core/pom.xml b/Plugins/Mineplex.Core/pom.xml index 45dbf6cfb..c4dbb202a 100644 --- a/Plugins/Mineplex.Core/pom.xml +++ b/Plugins/Mineplex.Core/pom.xml @@ -32,10 +32,6 @@ mineplex-serverdata ${project.version} - - fr.neatmonster - nocheatplus - org.apache.commons commons-dbcp2 diff --git a/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java b/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java index fbbe9c561..67e0e00fb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java @@ -10,7 +10,6 @@ import java.util.Set; import java.util.UUID; import mineplex.core.common.DummyEntity; -import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilPlayer; import mineplex.core.event.CustomTagEvent; import mineplex.core.packethandler.IPacketHandler; @@ -47,14 +46,7 @@ import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.plugin.java.JavaPlugin; -import fr.neatmonster.nocheatplus.checks.CheckType; -import fr.neatmonster.nocheatplus.checks.access.IViolationInfo; -import fr.neatmonster.nocheatplus.checks.moving.MovingData; -import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager; -import fr.neatmonster.nocheatplus.hooks.NCPHook; -import fr.neatmonster.nocheatplus.hooks.NCPHookManager; - -public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook +public class CustomTagFix extends MiniPlugin implements IPacketHandler { private Map> _entityMap = new HashMap<>(); private Map> _entityNameMap = new HashMap<>(); @@ -63,9 +55,6 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook private Set _loggedIn = new HashSet<>(); private Set _ignoreIds = new HashSet<>(); - private Map _exemptTimeMap = new HashMap<>(); - private Map> _doubleStrike = new HashMap<>(); - public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler) { super("Custom Tag Fix", plugin); @@ -73,10 +62,6 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook packetHandler.addPacketHandler(this, true, PacketPlayOutEntityDestroy.class, PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class, PacketPlayOutNamedEntitySpawn.class, PacketPlayInUseEntity.class, PacketPlayOutAttachEntity.class, PacketPlayOutNewAttachEntity.class); - - // NCPHookManager.addHook(CheckType.MOVING_SURVIVALFLY, this); - // NCPHookManager.addHook(CheckType.MOVING_PASSABLE, this); - NCPHookManager.addHook(CheckType.ALL, this); } @EventHandler @@ -97,82 +82,6 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook player.setCustomNameVisible(false); } - @EventHandler - public void ncpExempt(final PlayerToggleFlightEvent event) - { - long ignoreTime = System.currentTimeMillis() + 1500; - - if (_exemptTimeMap.containsKey(event.getPlayer().getUniqueId())) - { - _exemptTimeMap.put(event.getPlayer().getUniqueId(), - Math.max(ignoreTime, _exemptTimeMap.get(event.getPlayer().getUniqueId()))); - return; - } - - try - { - NCPExemptionManager.exemptPermanently(event.getPlayer()); - } - catch (Exception exception) - { - - } - - _exemptTimeMap.put(event.getPlayer().getUniqueId(), ignoreTime); - } - - @EventHandler - public void ncpExemptVelocity(final PlayerVelocityEvent event) - { - long ignoreTime = System.currentTimeMillis() + (long) (event.getVelocity().length() * 1500); - - if (_exemptTimeMap.containsKey(event.getPlayer().getUniqueId())) - { - _exemptTimeMap.put(event.getPlayer().getUniqueId(), - Math.max(ignoreTime, _exemptTimeMap.get(event.getPlayer().getUniqueId()))); - return; - } - - _exemptTimeMap.put(event.getPlayer().getUniqueId(), ignoreTime); - } - - @EventHandler - public void unexempt(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Iterator> iterator = _exemptTimeMap.entrySet().iterator(); iterator.hasNext(); ) - { - final Entry entry = iterator.next(); - - if (System.currentTimeMillis() > entry.getValue()) - { - iterator.remove(); - } - } - - for (Iterator>> iterator = _doubleStrike.entrySet().iterator(); iterator - .hasNext(); ) - { - Entry> entry = iterator.next(); - - for (Iterator> innerIterator = entry.getValue().entrySet().iterator(); innerIterator - .hasNext(); ) - { - final Entry entry2 = innerIterator.next(); - - if (System.currentTimeMillis() > entry2.getValue()) - { - innerIterator.remove(); - } - } - - if (entry.getValue() == null || entry.getValue().size() == 0) - iterator.remove(); - } - } - @EventHandler public void cleanMap(UpdateEvent event) { @@ -624,45 +533,4 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook } }); } - - @Override - public String getHookName() - { - return "Mineplex Hook"; - } - - @Override - public String getHookVersion() - { - return "Latest"; - } - - @Override - public boolean onCheckFailure(CheckType checkType, Player player, IViolationInfo violationInfo) - { - boolean failure = false; - - if (checkType == CheckType.MOVING_SURVIVALFLY || checkType == CheckType.MOVING_PASSABLE) - { - failure = _exemptTimeMap.containsKey(player.getUniqueId()); - - if (failure) - MovingData.getData(player).clearFlyData(); - } - - // This is the second strike system. - if (!failure) - { - if (!_doubleStrike.containsKey(player.getUniqueId()) - || !_doubleStrike.get(player.getUniqueId()).containsKey(checkType.getParent())) - failure = true; - - if (!_doubleStrike.containsKey(player.getUniqueId())) - _doubleStrike.put(player.getUniqueId(), new NautHashMap()); - - _doubleStrike.get(player.getUniqueId()).put(checkType.getParent(), System.currentTimeMillis() + 5000); - } - - return failure; - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/NCPDataManFix.java b/Plugins/Mineplex.Core/src/mineplex/core/NCPDataManFix.java deleted file mode 100644 index c531ad097..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/NCPDataManFix.java +++ /dev/null @@ -1,10 +0,0 @@ -package mineplex.core; - -import fr.neatmonster.nocheatplus.config.ConfigManager; - -public class NCPDataManFix -{ - public NCPDataManFix() { - //ConfigManager.getConfigFile().set("data.consistencychecks.suppresswarnings", true); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/pom.xml b/Plugins/Nautilus.Game.Arcade/pom.xml index f23ada168..6c69780d2 100644 --- a/Plugins/Nautilus.Game.Arcade/pom.xml +++ b/Plugins/Nautilus.Game.Arcade/pom.xml @@ -19,9 +19,5 @@ mineplex-minecraft-game-classcombat ${project.version} - - fr.neatmonster - nocheatplus - diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java index d1dbcb8a4..fc760b7fb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java @@ -32,7 +32,6 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.ItemStack; -import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager; import mineplex.core.common.MinecraftVersion; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -280,18 +279,6 @@ public class Skyfall extends SoloGame { spawn.clone().subtract(0, 1, 0).getBlock().setType(Material.AIR); } - - for (Player player : GetPlayers(true)) - { - NCPExemptionManager.exemptPermanently(player); - } - } - if (event.GetState() == GameState.End || event.GetState() == GameState.Dead) - { - for (Player player : UtilServer.getPlayers()) - { - NCPExemptionManager.unexempt(player); - } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 18d67e8ca..9c086a1aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -1,11 +1,6 @@ package nautilus.game.arcade.game.games.uhc; import com.mineplex.spigot.ChunkPreLoadEvent; -import fr.neatmonster.nocheatplus.checks.CheckType; -import fr.neatmonster.nocheatplus.checks.access.IViolationInfo; -import fr.neatmonster.nocheatplus.hooks.NCPHook; -import fr.neatmonster.nocheatplus.hooks.NCPHookManager; -import mineplex.core.Managers; import mineplex.core.account.CoreClient; import mineplex.core.boosters.event.BoosterItemGiveEvent; import mineplex.core.common.Pair; @@ -120,7 +115,7 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.atomic.AtomicInteger; -public class UHC extends TeamGame implements NCPHook +public class UHC extends TeamGame { // The view distance of UHC. The amount of time and ram needed grows polynomially public static final int VIEW_DISTANCE = 5; @@ -288,8 +283,6 @@ public class UHC extends TeamGame implements NCPHook _healthObjective = Scoreboard.getScoreboard().registerNewObjective("Health", "health"); _healthObjective.setDisplaySlot(DisplaySlot.PLAYER_LIST); - NCPHookManager.addHook(CheckType.ALL, this); - registerModule(new TeamModule()); } @@ -727,7 +720,6 @@ public class UHC extends TeamGame implements NCPHook MinecraftServer.getServer().worlds.add(((CraftWorld) WorldData.World).getHandle()); } HandlerList.unregisterAll(_chunkLoadingThread); - NCPHookManager.removeHook(this); // if (_chunkUnloadTaskId != -1) // { @@ -1777,28 +1769,6 @@ public class UHC extends TeamGame implements NCPHook } } - @Override - public String getHookName() - { - return "UHC Hook"; - } - - @Override - public String getHookVersion() - { - return "0.0.1"; - } - - @Override - public boolean onCheckFailure(CheckType checkType, Player player, IViolationInfo iViolationInfo) - { - if (GetState() == GameState.Prepare) - { - return false; - } - return true; - } - private static int _gamesRun = 0; @EventHandler diff --git a/Plugins/pom.xml b/Plugins/pom.xml index 63be70949..1a52b40a0 100644 --- a/Plugins/pom.xml +++ b/Plugins/pom.xml @@ -68,12 +68,6 @@ 1.9 provided - - fr.neatmonster - nocheatplus - 3.12.1-SNAPSHOT - provided - javax.mail mail