Remove NCP

This commit is contained in:
Shaun Bennett 2016-09-21 22:21:49 -04:00
parent ac967f6b18
commit 9be26a92d1
7 changed files with 2 additions and 201 deletions

View File

@ -32,10 +32,6 @@
<artifactId>mineplex-serverdata</artifactId> <artifactId>mineplex-serverdata</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId> <artifactId>commons-dbcp2</artifactId>

View File

@ -10,7 +10,6 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mineplex.core.common.DummyEntity; import mineplex.core.common.DummyEntity;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.event.CustomTagEvent; import mineplex.core.event.CustomTagEvent;
import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.IPacketHandler;
@ -47,14 +46,7 @@ import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import fr.neatmonster.nocheatplus.checks.CheckType; public class CustomTagFix extends MiniPlugin implements IPacketHandler
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
{ {
private Map<UUID, Map<Integer, Integer[]>> _entityMap = new HashMap<>(); private Map<UUID, Map<Integer, Integer[]>> _entityMap = new HashMap<>();
private Map<UUID, Map<Integer, String>> _entityNameMap = new HashMap<>(); private Map<UUID, Map<Integer, String>> _entityNameMap = new HashMap<>();
@ -63,9 +55,6 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
private Set<UUID> _loggedIn = new HashSet<>(); private Set<UUID> _loggedIn = new HashSet<>();
private Set<Integer> _ignoreIds = new HashSet<>(); private Set<Integer> _ignoreIds = new HashSet<>();
private Map<UUID, Long> _exemptTimeMap = new HashMap<>();
private Map<UUID, NautHashMap<CheckType, Long>> _doubleStrike = new HashMap<>();
public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler) public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler)
{ {
super("Custom Tag Fix", plugin); 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, packetHandler.addPacketHandler(this, true, PacketPlayOutEntityDestroy.class, PacketPlayOutEntityMetadata.class,
PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class, PacketPlayOutNamedEntitySpawn.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class, PacketPlayOutNamedEntitySpawn.class,
PacketPlayInUseEntity.class, PacketPlayOutAttachEntity.class, PacketPlayOutNewAttachEntity.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 @EventHandler
@ -97,82 +82,6 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
player.setCustomNameVisible(false); 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<Entry<UUID, Long>> iterator = _exemptTimeMap.entrySet().iterator(); iterator.hasNext(); )
{
final Entry<UUID, Long> entry = iterator.next();
if (System.currentTimeMillis() > entry.getValue())
{
iterator.remove();
}
}
for (Iterator<Entry<UUID, NautHashMap<CheckType, Long>>> iterator = _doubleStrike.entrySet().iterator(); iterator
.hasNext(); )
{
Entry<UUID, NautHashMap<CheckType, Long>> entry = iterator.next();
for (Iterator<Entry<CheckType, Long>> innerIterator = entry.getValue().entrySet().iterator(); innerIterator
.hasNext(); )
{
final Entry<CheckType, Long> entry2 = innerIterator.next();
if (System.currentTimeMillis() > entry2.getValue())
{
innerIterator.remove();
}
}
if (entry.getValue() == null || entry.getValue().size() == 0)
iterator.remove();
}
}
@EventHandler @EventHandler
public void cleanMap(UpdateEvent event) 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<CheckType, Long>());
_doubleStrike.get(player.getUniqueId()).put(checkType.getParent(), System.currentTimeMillis() + 5000);
}
return failure;
}
} }

View File

@ -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);
}
}

View File

@ -19,9 +19,5 @@
<artifactId>mineplex-minecraft-game-classcombat</artifactId> <artifactId>mineplex-minecraft-game-classcombat</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -32,7 +32,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
import mineplex.core.common.MinecraftVersion; import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; 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); 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);
}
} }
} }

View File

@ -1,11 +1,6 @@
package nautilus.game.arcade.game.games.uhc; package nautilus.game.arcade.game.games.uhc;
import com.mineplex.spigot.ChunkPreLoadEvent; 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.account.CoreClient;
import mineplex.core.boosters.event.BoosterItemGiveEvent; import mineplex.core.boosters.event.BoosterItemGiveEvent;
import mineplex.core.common.Pair; import mineplex.core.common.Pair;
@ -120,7 +115,7 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger; 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 // The view distance of UHC. The amount of time and ram needed grows polynomially
public static final int VIEW_DISTANCE = 5; 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 = Scoreboard.getScoreboard().registerNewObjective("Health", "health");
_healthObjective.setDisplaySlot(DisplaySlot.PLAYER_LIST); _healthObjective.setDisplaySlot(DisplaySlot.PLAYER_LIST);
NCPHookManager.addHook(CheckType.ALL, this);
registerModule(new TeamModule()); registerModule(new TeamModule());
} }
@ -727,7 +720,6 @@ public class UHC extends TeamGame implements NCPHook
MinecraftServer.getServer().worlds.add(((CraftWorld) WorldData.World).getHandle()); MinecraftServer.getServer().worlds.add(((CraftWorld) WorldData.World).getHandle());
} }
HandlerList.unregisterAll(_chunkLoadingThread); HandlerList.unregisterAll(_chunkLoadingThread);
NCPHookManager.removeHook(this);
// if (_chunkUnloadTaskId != -1) // 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; private static int _gamesRun = 0;
@EventHandler @EventHandler

View File

@ -68,12 +68,6 @@
<version>1.9</version> <version>1.9</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus</artifactId>
<version>3.12.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>javax.mail</groupId> <groupId>javax.mail</groupId>
<artifactId>mail</artifactId> <artifactId>mail</artifactId>