From f662f9836901a449e05ba8283ceb6fffe4104db4 Mon Sep 17 00:00:00 2001 From: NeatMonster Date: Fri, 24 Aug 2012 14:52:24 +0200 Subject: [PATCH] NetServerHandler improved. Metrics can now be fully disabled. Permission for viewing plugins and versions (re-)added. --- plugin.yml | 4 +- .../nocheatplus/CommandHandler.java | 7 + .../nocheatplus/NCPNetServerHandler.java | 733 ++++++++++++++++++ .../neatmonster/nocheatplus/NoCheatPlus.java | 131 ++-- .../nocheatplus/checks/chat/ChatListener.java | 3 +- .../nocheatplus/config/ConfPaths.java | 378 ++++----- .../nocheatplus/config/DefaultConfig.java | 5 +- .../nocheatplus/metrics/MetricsData.java | 41 +- .../packets/NCPPacket11PlayerPosition.java | 49 -- .../packets/NCPPacket13PlayerLookMove.java | 57 -- .../packets/PacketsWorkaround.java | 73 -- .../nocheatplus/players/Permissions.java | 2 +- 12 files changed, 1043 insertions(+), 440 deletions(-) create mode 100644 src/fr/neatmonster/nocheatplus/NCPNetServerHandler.java delete mode 100644 src/fr/neatmonster/nocheatplus/packets/NCPPacket11PlayerPosition.java delete mode 100644 src/fr/neatmonster/nocheatplus/packets/NCPPacket13PlayerLookMove.java delete mode 100644 src/fr/neatmonster/nocheatplus/packets/PacketsWorkaround.java diff --git a/plugin.yml b/plugin.yml index 5a7948d0..4692b9b0 100644 --- a/plugin.yml +++ b/plugin.yml @@ -114,8 +114,6 @@ permissions: description: Allow the player to bypass the MorePacketsVehicle check. nocheatplus.checks.moving.nofall: description: Allow the player to bypass the NoFall check. - nocheatplus.checks.moving.overridebukkit: - description: Allow the overriding of Bukkit to prevent it from blocking fly mods. nocheatplus.checks.moving.survivalfly: description: Allow the player to bypass the SurvivalFly check. children: @@ -125,6 +123,8 @@ permissions: description: Allow the player to move without speed limits while sneaking. nocheatplus.checks.moving.survivalfly.sprinting: description: Allow the player to sprint backwards. + nocheatplus.checks.moving.survivalfly.step: + description: Allow the player to use the 'step' functionality of his client. nocheatplus.mods: description: Allow the player to use all the client mods. children: diff --git a/src/fr/neatmonster/nocheatplus/CommandHandler.java b/src/fr/neatmonster/nocheatplus/CommandHandler.java index 517eb664..6cd8670e 100644 --- a/src/fr/neatmonster/nocheatplus/CommandHandler.java +++ b/src/fr/neatmonster/nocheatplus/CommandHandler.java @@ -158,6 +158,13 @@ public class CommandHandler implements CommandExecutor { @Override public boolean onCommand(final CommandSender sender, final Command command, final String commandLabel, final String[] args) { + /* + * ____ _ + * / ___|___ _ __ ___ _ __ ___ __ _ _ __ __| | + * | | / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` | + * | |__| (_) | | | | | | | | | | | (_| | | | | (_| | + * \____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_| + */ // Not our command, how did it get here? if (!command.getName().equalsIgnoreCase("nocheatplus")) return false; diff --git a/src/fr/neatmonster/nocheatplus/NCPNetServerHandler.java b/src/fr/neatmonster/nocheatplus/NCPNetServerHandler.java new file mode 100644 index 00000000..aebd3f59 --- /dev/null +++ b/src/fr/neatmonster/nocheatplus/NCPNetServerHandler.java @@ -0,0 +1,733 @@ +package fr.neatmonster.nocheatplus; + +import java.lang.reflect.Field; +import java.util.List; + +import net.minecraft.server.AxisAlignedBB; +import net.minecraft.server.EntityPlayer; +import net.minecraft.server.INetworkManager; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.NetServerHandler; +import net.minecraft.server.Packet; +import net.minecraft.server.Packet0KeepAlive; +import net.minecraft.server.Packet101CloseWindow; +import net.minecraft.server.Packet102WindowClick; +import net.minecraft.server.Packet106Transaction; +import net.minecraft.server.Packet107SetCreativeSlot; +import net.minecraft.server.Packet108ButtonClick; +import net.minecraft.server.Packet10Flying; +import net.minecraft.server.Packet130UpdateSign; +import net.minecraft.server.Packet13PlayerLookMove; +import net.minecraft.server.Packet14BlockDig; +import net.minecraft.server.Packet15Place; +import net.minecraft.server.Packet16BlockItemSwitch; +import net.minecraft.server.Packet18ArmAnimation; +import net.minecraft.server.Packet19EntityAction; +import net.minecraft.server.Packet202Abilities; +import net.minecraft.server.Packet203TabComplete; +import net.minecraft.server.Packet204LocaleAndViewDistance; +import net.minecraft.server.Packet205ClientCommand; +import net.minecraft.server.Packet250CustomPayload; +import net.minecraft.server.Packet255KickDisconnect; +import net.minecraft.server.Packet3Chat; +import net.minecraft.server.Packet7UseEntity; +import net.minecraft.server.Packet9Respawn; +import net.minecraft.server.ServerConnection; +import net.minecraft.server.WorldServer; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.craftbukkit.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerTeleportEvent; + +/* + * M"""""""`YM MM'""""'YMM MM"""""""`YM M"""""""`YM dP MP""""""`MM + * M mmmm. M M' .mmm. `M MM mmmmm M M mmmm. M 88 M mmmmm..M + * M MMMMM M M MMMMMooM M' .M M MMMMM M .d8888b. d8888P M. `YM .d8888b. 88d888b. dP .dP .d8888b. 88d888b. + * M MMMMM M M MMMMMMMM MM MMMMMMMM M MMMMM M 88ooood8 88 MMMMMMM. M 88ooood8 88' `88 88 d8' 88ooood8 88' `88 + * M MMMMM M M. `MMM' .M MM MMMMMMMM M MMMMM M 88. ... 88 M. .MMM' M 88. ... 88 88 .88' 88. ... 88 + * M MMMMM M MM. .dM MM MMMMMMMM M MMMMM M `88888P' dP Mb. .dM `88888P' dP 8888P' `88888P' dP + * MMMMMMMMMMM MMMMMMMMMMM MMMMMMMMMMMM MMMMMMMMMMM MMMMMMMMMMM + * + * M""MMMMM""MM dP dP + * M MMMMM MM 88 88 + * M `M .d8888b. 88d888b. .d888b88 88 .d8888b. 88d888b. + * M MMMMM MM 88' `88 88' `88 88' `88 88 88ooood8 88' `88 + * M MMMMM MM 88. .88 88 88 88. .88 88 88. ... 88 + * M MMMMM MM `88888P8 dP dP `88888P8 dP `88888P' dP + * MMMMMMMMMMMM + */ +/** + * A custom NetServerHandler used as a workaround to prevent CraftBukkit from blocking fly mods. + */ +public class NCPNetServerHandler extends NetServerHandler { + + /** The default stance of a player. */ + private static final double STANCE = 1.6200000047683716D; + + /** + * Sets the NetServerHandler of the player. + * + * @param player + * the player + * @param useProxy + * the use proxy + */ + public static void changeNetServerHandler(final Player player, final boolean useProxy) { + final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle(); + final NetServerHandler vanillaNSH = entityPlayer.netServerHandler; + final NCPNetServerHandler customNSH = new NCPNetServerHandler(MinecraftServer.getServer(), + vanillaNSH.networkManager, entityPlayer, useProxy ? vanillaNSH : null); + customNSH.a(entityPlayer.locX, entityPlayer.locY, entityPlayer.locZ, entityPlayer.yaw, entityPlayer.pitch); + MinecraftServer.getServer().ac().a(customNSH); + try { + final Field connectionsField = ServerConnection.class.getDeclaredField("d"); + connectionsField.setAccessible(true); + ((List) connectionsField.get(MinecraftServer.getServer().ac())).remove(vanillaNSH); + } catch (final Exception e) { + e.printStackTrace(); + } + vanillaNSH.disconnected = !useProxy; + } + + private Field hField = null; + private final NetServerHandler netServerHandler; + + private double bukkitX = Double.MAX_VALUE; + private double bukkitY = Double.MAX_VALUE; + private double bukkitZ = Double.MAX_VALUE; + private float bukkitPitch = Float.MAX_VALUE; + private float bukkitYaw = Float.MAX_VALUE; + private boolean checkMovement; + private int flyingPackets; + private boolean justTeleported = false; + private double vanillaX; + private double vanillaY; + private double vanillaZ; + + /** + * Instantiates a new nCP net server handler. + * + * @param minecraftServer + * the minecraft server + * @param networkManager + * the network manager + * @param entityPlayer + * the entity player + * @param netServerHandler + * the net server handler + */ + public NCPNetServerHandler(final MinecraftServer minecraftServer, final INetworkManager networkManager, + final EntityPlayer entityPlayer, final NetServerHandler netServerHandler) { + super(minecraftServer, networkManager, entityPlayer); + this.netServerHandler = netServerHandler; + try { + hField = NetServerHandler.class.getDeclaredField("h"); + hField.setAccessible(true); + } catch (final Exception e) { + e.printStackTrace(); + } + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a() + */ + @Override + public boolean a() { + if (netServerHandler != null) + return netServerHandler.a(); + return super.a(); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(double, double, double, float, float) + */ + @Override + public void a(final double d0, final double d1, final double d2, final float f, final float f1) { + if (netServerHandler != null) + netServerHandler.a(d0, d1, d2, f, f1); + else + super.a(d0, d1, d2, f, f1); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet0KeepAlive) + */ + @Override + public void a(final Packet0KeepAlive packet0KeepAlive) { + if (netServerHandler != null) + netServerHandler.a(packet0KeepAlive); + else + super.a(packet0KeepAlive); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet102WindowClick) + */ + @Override + public void a(final Packet102WindowClick packet102WindowClick) { + if (netServerHandler != null) + netServerHandler.a(packet102WindowClick); + else + super.a(packet102WindowClick); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet106Transaction) + */ + @Override + public void a(final Packet106Transaction packet106Transaction) { + if (netServerHandler != null) + netServerHandler.a(packet106Transaction); + else + super.a(packet106Transaction); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet107SetCreativeSlot) + */ + @Override + public void a(final Packet107SetCreativeSlot packet107SetCreativeSlot) { + if (netServerHandler != null) + netServerHandler.a(packet107SetCreativeSlot); + else + super.a(packet107SetCreativeSlot); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet108ButtonClick) + */ + @Override + public void a(final Packet108ButtonClick packet108ButtonClick) { + if (netServerHandler != null) + netServerHandler.a(packet108ButtonClick); + else + super.a(packet108ButtonClick); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet10Flying) + */ + @Override + public void a(final Packet10Flying packet10Flying) { + final WorldServer worldserver = MinecraftServer.getServer().getWorldServer(player.dimension); + + try { + hField.set(netServerHandler == null ? this : netServerHandler, true); + } catch (final Exception e) { + e.printStackTrace(); + } + + if (!player.viewingCredits) { + double d0; + + if (!checkMovement) { + d0 = packet10Flying.y - vanillaY; + if (packet10Flying.x == vanillaX && d0 * d0 < 0.01D && packet10Flying.z == vanillaZ) + checkMovement = true; + } + + final Player bPlayer = getPlayer(); + final Location from = new Location(bPlayer.getWorld(), bukkitX, bukkitY, bukkitZ, bukkitYaw, bukkitPitch); + final Location to = bPlayer.getLocation().clone(); + + if (packet10Flying.hasPos && (packet10Flying.y != -999.0D || packet10Flying.stance != -999.0D)) { + to.setX(packet10Flying.x); + to.setY(packet10Flying.y); + to.setZ(packet10Flying.z); + } + + if (packet10Flying.hasLook) { + to.setYaw(packet10Flying.yaw); + to.setPitch(packet10Flying.pitch); + } + + final double delta = Math.pow(bukkitX - to.getX(), 2) + Math.pow(bukkitY - to.getY(), 2) + + Math.pow(bukkitZ - to.getZ(), 2); + final float deltaAngle = Math.abs(bukkitYaw - to.getYaw()) + Math.abs(bukkitPitch - to.getPitch()); + + if ((delta > 1f / 256 || deltaAngle > 10f) && checkMovement && !player.dead) { + bukkitX = to.getX(); + bukkitY = to.getY(); + bukkitZ = to.getZ(); + bukkitYaw = to.getYaw(); + bukkitPitch = to.getPitch(); + + if (from.getX() != Double.MAX_VALUE) { + final PlayerMoveEvent event = new PlayerMoveEvent(bPlayer, from, to); + Bukkit.getPluginManager().callEvent(event); + + if (event.isCancelled()) { + sendPacket(new Packet13PlayerLookMove(from.getX(), from.getY() + STANCE, from.getY(), + from.getZ(), from.getYaw(), from.getPitch(), false)); + return; + } + + if (!to.equals(event.getTo()) && !event.isCancelled()) { + player.getBukkitEntity().teleport(event.getTo(), PlayerTeleportEvent.TeleportCause.UNKNOWN); + return; + } + + if (!from.equals(getPlayer().getLocation()) && justTeleported) { + justTeleported = false; + return; + } + } + } + + if (Double.isNaN(packet10Flying.x) || Double.isNaN(packet10Flying.y) || Double.isNaN(packet10Flying.z) + || Double.isNaN(packet10Flying.stance)) { + bPlayer.teleport(bPlayer.getWorld().getSpawnLocation(), PlayerTeleportEvent.TeleportCause.UNKNOWN); + System.err.println(bPlayer.getName() + + " was caught trying to crash the server with an invalid position."); + bPlayer.kickPlayer("Nope!"); + return; + } + + if (checkMovement && !player.dead) { + double d1; + double d2; + double d3; + double d4; + + if (player.vehicle != null) { + float f = player.yaw; + float f1 = player.pitch; + + player.vehicle.V(); + d1 = player.locX; + d2 = player.locY; + d3 = player.locZ; + double d5 = 0.0D; + + d4 = 0.0D; + if (packet10Flying.hasLook) { + f = packet10Flying.yaw; + f1 = packet10Flying.pitch; + } + + if (packet10Flying.hasPos && packet10Flying.y == -999.0D && packet10Flying.stance == -999.0D) { + if (Math.abs(packet10Flying.x) > 1 || Math.abs(packet10Flying.z) > 1) { + System.err.println(bPlayer.getName() + + " was caught trying to crash the server with an invalid position."); + bPlayer.kickPlayer("Nope!"); + return; + } + + d5 = packet10Flying.x; + d4 = packet10Flying.z; + } + + player.onGround = packet10Flying.g; + player.g(); + player.move(d5, 0.0D, d4); + player.setLocation(d1, d2, d3, f, f1); + player.motX = d5; + player.motZ = d4; + if (player.vehicle != null) + worldserver.vehicleEnteredWorld(player.vehicle, true); + + if (player.vehicle != null) + player.vehicle.V(); + + MinecraftServer.getServer().getServerConfigurationManager().d(player); + vanillaX = player.locX; + vanillaY = player.locY; + vanillaZ = player.locZ; + worldserver.playerJoinedWorld(player); + return; + } + + if (player.isSleeping()) { + player.g(); + player.setLocation(vanillaX, vanillaY, vanillaZ, player.yaw, player.pitch); + worldserver.playerJoinedWorld(player); + return; + } + + d0 = player.locY; + vanillaX = player.locX; + vanillaY = player.locY; + vanillaZ = player.locZ; + d1 = player.locX; + d2 = player.locY; + d3 = player.locZ; + float f2 = player.yaw; + float f3 = player.pitch; + + if (packet10Flying.hasPos && packet10Flying.y == -999.0D && packet10Flying.stance == -999.0D) + packet10Flying.hasPos = false; + + if (packet10Flying.hasPos) { + d1 = packet10Flying.x; + d2 = packet10Flying.y; + d3 = packet10Flying.z; + d4 = packet10Flying.stance - packet10Flying.y; + if (!player.isSleeping() && (d4 > 1.65D || d4 < 0.1D)) { + disconnect("Illegal stance"); + logger.warning(player.name + " had an illegal stance: " + d4); + return; + } + + if (Math.abs(packet10Flying.x) > 3.2E7D || Math.abs(packet10Flying.z) > 3.2E7D) { + disconnect("Illegal position"); + return; + } + } + + if (packet10Flying.hasLook) { + f2 = packet10Flying.yaw; + f3 = packet10Flying.pitch; + } + + player.g(); + player.V = 0.0F; + player.setLocation(vanillaX, vanillaY, vanillaZ, f2, f3); + if (!checkMovement) + return; + + d4 = d1 - player.locX; + double d6 = d2 - player.locY; + double d7 = d3 - player.locZ; + + final float f4 = 0.0625F; + final boolean flag = worldserver.getCubes(player, player.boundingBox.clone().shrink(f4, f4, f4)) + .isEmpty(); + + if (player.onGround && !packet10Flying.g && d6 > 0.0D) + player.j(0.2F); + + player.move(d4, d6, d7); + player.onGround = packet10Flying.g; + player.checkMovement(d4, d6, d7); + final double d12 = d6; + + d4 = d1 - player.locX; + d6 = d2 - player.locY; + if (d6 > -0.5D || d6 < 0.5D) + d6 = 0.0D; + + d7 = d3 - player.locZ; + + player.setLocation(d1, d2, d3, f2, f3); + final boolean flag2 = worldserver.getCubes(player, player.boundingBox.clone().shrink(f4, f4, f4)) + .isEmpty(); + + if (flag && !flag2 && !player.isSleeping()) { + this.a(vanillaX, vanillaY, vanillaZ, f2, f3); + return; + } + + final AxisAlignedBB axisalignedbb = player.boundingBox.clone().grow(f4, f4, f4).a(0.0D, -0.55D, 0.0D); + + if (!MinecraftServer.getServer().getAllowFlight() && !player.abilities.canFly + && !worldserver.c(axisalignedbb)) { + if (d12 >= -0.03125D) { + flyingPackets++; + if (flyingPackets > 80) { + logger.warning(player.name + " was kicked for floating too long!"); + disconnect("Flying is not enabled on this server"); + return; + } + } + } else + flyingPackets = 0; + + player.onGround = packet10Flying.g; + MinecraftServer.getServer().getServerConfigurationManager().d(player); + if (player.itemInWorldManager.isCreative()) + return; + player.b(player.locY - d0, packet10Flying.g); + } + } + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet130UpdateSign) + */ + @Override + public void a(final Packet130UpdateSign packet130UpdateSign) { + if (netServerHandler != null) + netServerHandler.a(packet130UpdateSign); + else + super.a(packet130UpdateSign); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet14BlockDig) + */ + @Override + public void a(final Packet14BlockDig packet14BlockDig) { + if (netServerHandler != null) + netServerHandler.a(packet14BlockDig); + else + super.a(packet14BlockDig); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet15Place) + */ + @Override + public void a(final Packet15Place packet15Place) { + if (netServerHandler != null) + netServerHandler.a(packet15Place); + else + super.a(packet15Place); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet16BlockItemSwitch) + */ + @Override + public void a(final Packet16BlockItemSwitch packet16BlockItemSwitch) { + if (netServerHandler != null) + netServerHandler.a(packet16BlockItemSwitch); + else + super.a(packet16BlockItemSwitch); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet18ArmAnimation) + */ + @Override + public void a(final Packet18ArmAnimation packet18ArmAnimation) { + if (netServerHandler != null) + netServerHandler.a(packet18ArmAnimation); + else + super.a(packet18ArmAnimation); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet19EntityAction) + */ + @Override + public void a(final Packet19EntityAction packet19EntityAction) { + if (netServerHandler != null) + netServerHandler.a(packet19EntityAction); + else + super.a(packet19EntityAction); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet202Abilities) + */ + @Override + public void a(final Packet202Abilities packet202Abilities) { + if (netServerHandler != null) + netServerHandler.a(packet202Abilities); + else + super.a(packet202Abilities); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet203TabComplete) + */ + @Override + public void a(final Packet203TabComplete packet203TabComplete) { + if (netServerHandler != null) + netServerHandler.a(packet203TabComplete); + else + super.a(packet203TabComplete); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet204LocaleAndViewDistance) + */ + @Override + public void a(final Packet204LocaleAndViewDistance packet204LocaleAndViewDistance) { + if (netServerHandler != null) + netServerHandler.a(packet204LocaleAndViewDistance); + else + super.a(packet204LocaleAndViewDistance); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet205ClientCommand) + */ + @Override + public void a(final Packet205ClientCommand packet205ClientCommand) { + if (netServerHandler != null) + netServerHandler.a(packet205ClientCommand); + else + super.a(packet205ClientCommand); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet250CustomPayload) + */ + @Override + public void a(final Packet250CustomPayload packet250CustomPayload) { + if (netServerHandler != null) + netServerHandler.a(packet250CustomPayload); + else + super.a(packet250CustomPayload); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet255KickDisconnect) + */ + @Override + public void a(final Packet255KickDisconnect packet255KickDisconnect) { + if (netServerHandler != null) + netServerHandler.a(packet255KickDisconnect); + else + super.a(packet255KickDisconnect); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet3Chat) + */ + @Override + public void a(final Packet3Chat packet3Chat) { + if (netServerHandler != null) + netServerHandler.a(packet3Chat); + else + super.a(packet3Chat); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet7UseEntity) + */ + @Override + public void a(final Packet7UseEntity packet7UseEntity) { + if (netServerHandler != null) + netServerHandler.a(packet7UseEntity); + else + super.a(packet7UseEntity); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(net.minecraft.server.Packet9Respawn) + */ + @Override + public void a(final Packet9Respawn packet9Respawn) { + if (netServerHandler != null) + netServerHandler.a(packet9Respawn); + else + super.a(packet9Respawn); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#a(java.lang.String, java.lang.Object[]) + */ + @Override + public void a(final String s, final Object[] aobject) { + if (netServerHandler != null) + netServerHandler.a(s, aobject); + else + super.a(s, aobject); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#b() + */ + @Override + public boolean b() { + if (netServerHandler != null) + return netServerHandler.b(); + return super.b(); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#chat(java.lang.String, boolean) + */ + @Override + public void chat(final String s, final boolean async) { + if (netServerHandler != null) + netServerHandler.chat(s, async); + else + super.chat(s, async); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#d() + */ + @Override + public void d() { + if (netServerHandler != null) + netServerHandler.d(); + else + super.d(); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#disconnect(java.lang.String) + */ + @Override + public void disconnect(final String s) { + if (netServerHandler != null) + netServerHandler.disconnect(s); + else + super.disconnect(s); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#getPlayer() + */ + @Override + public CraftPlayer getPlayer() { + if (netServerHandler != null) + return netServerHandler.getPlayer(); + return super.getPlayer(); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#handleContainerClose(net.minecraft.server.Packet101CloseWindow) + */ + @Override + public void handleContainerClose(final Packet101CloseWindow packet101CloseWindow) { + if (netServerHandler != null) + netServerHandler.handleContainerClose(packet101CloseWindow); + else + super.handleContainerClose(packet101CloseWindow); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#lowPriorityCount() + */ + @Override + public int lowPriorityCount() { + if (netServerHandler != null) + return netServerHandler.lowPriorityCount(); + return super.lowPriorityCount(); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#onUnhandledPacket(net.minecraft.server.Packet) + */ + @Override + public void onUnhandledPacket(final Packet packet) { + if (netServerHandler != null) + netServerHandler.onUnhandledPacket(packet); + else + super.onUnhandledPacket(packet); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#sendPacket(net.minecraft.server.Packet) + */ + @Override + public void sendPacket(final Packet packet) { + if (netServerHandler != null) + netServerHandler.sendPacket(packet); + else + super.sendPacket(packet); + } + + /* (non-Javadoc) + * @see net.minecraft.server.NetServerHandler#teleport(org.bukkit.Location) + */ + @Override + public void teleport(final Location dest) { + final double x = bukkitX = vanillaX = dest.getX(); + final double y = bukkitY = vanillaY = dest.getY(); + final double z = bukkitZ = vanillaZ = dest.getZ(); + final float yaw = bukkitYaw = Float.isNaN(dest.getYaw()) ? 0f : dest.getYaw(); + final float pitch = bukkitPitch = Float.isNaN(dest.getPitch()) ? 0f : dest.getPitch(); + checkMovement = !(justTeleported = true); + player.setLocation(x, y, z, yaw, pitch); + sendPacket(new Packet13PlayerLookMove(x, y + STANCE, y, z, yaw, pitch, false)); + } +} diff --git a/src/fr/neatmonster/nocheatplus/NoCheatPlus.java b/src/fr/neatmonster/nocheatplus/NoCheatPlus.java index 19f744f0..42f228e1 100644 --- a/src/fr/neatmonster/nocheatplus/NoCheatPlus.java +++ b/src/fr/neatmonster/nocheatplus/NoCheatPlus.java @@ -28,13 +28,13 @@ import fr.neatmonster.nocheatplus.checks.fight.FightListener; import fr.neatmonster.nocheatplus.checks.inventory.InventoryListener; import fr.neatmonster.nocheatplus.checks.moving.MovingListener; import fr.neatmonster.nocheatplus.config.ConfPaths; +import fr.neatmonster.nocheatplus.config.ConfigFile; import fr.neatmonster.nocheatplus.config.ConfigManager; import fr.neatmonster.nocheatplus.metrics.Metrics; import fr.neatmonster.nocheatplus.metrics.Metrics.Graph; import fr.neatmonster.nocheatplus.metrics.Metrics.Plotter; import fr.neatmonster.nocheatplus.metrics.MetricsData; import fr.neatmonster.nocheatplus.metrics.MetricsData.TicksPlotter; -import fr.neatmonster.nocheatplus.packets.PacketsWorkaround; import fr.neatmonster.nocheatplus.players.Permissions; import fr.neatmonster.nocheatplus.utilities.LagMeasureTask; @@ -66,14 +66,18 @@ public class NoCheatPlus extends JavaPlugin implements Listener { */ @Override public void onDisable() { + /* + * ____ _ _ _ + * | _ \(_)___ __ _| |__ | | ___ + * | | | | / __|/ _` | '_ \| |/ _ \ + * | |_| | \__ \ (_| | |_) | | __/ + * |____/|_|___/\__,_|_.__/|_|\___| + */ final PluginDescriptionFile pdfFile = getDescription(); // Stop the lag measuring task. LagMeasureTask.cancel(); - // Disable the packets workaround. - PacketsWorkaround.disable(); - // Cleanup the configuration manager. ConfigManager.cleanup(); @@ -89,6 +93,13 @@ public class NoCheatPlus extends JavaPlugin implements Listener { */ @Override public void onEnable() { + /* + * _____ _ _ + * | ____|_ __ __ _| |__ | | ___ + * | _| | '_ \ / _` | '_ \| |/ _ \ + * | |___| | | | (_| | |_) | | __/ + * |_____|_| |_|\__,_|_.__/|_|\___| + */ // Read the configuration files. ConfigManager.init(this); @@ -102,10 +113,6 @@ public class NoCheatPlus extends JavaPlugin implements Listener { listeners.add(new MovingListener()); listeners.add(new Workarounds()); - // Enable the packets workaround. - if (ConfigManager.getConfigFile().getBoolean(ConfPaths.MISCELLANEOUS_NOMOVEDTOOQUICKLY)) - PacketsWorkaround.enable(); - // Set up a task to monitor server lag. LagMeasureTask.start(this); @@ -118,46 +125,47 @@ public class NoCheatPlus extends JavaPlugin implements Listener { getCommand("nocheatplus").setExecutor(new CommandHandler(this)); // Setup the graphs, plotters and start Metrics. - try { - final Metrics metrics = new Metrics(this); - final Graph eventsChecked = metrics.createGraph("Events Checked"); - final Graph checksFailed = metrics.createGraph("Checks Failed"); - final Graph violationLevels = metrics.createGraph("Violation Levels"); - for (final CheckType type : CheckType.values()) - if (type == CheckType.ALL || type.getParent() != null) { - eventsChecked.addPlotter(new Plotter(type.name()) { + if (ConfigManager.getConfigFile().getBoolean(ConfPaths.MISCELLANEOUS_REPORTTOMETRICS)) + try { + final Metrics metrics = new Metrics(this); + final Graph eventsChecked = metrics.createGraph("Events Checked"); + final Graph checksFailed = metrics.createGraph("Checks Failed"); + final Graph violationLevels = metrics.createGraph("Violation Levels"); + for (final CheckType type : CheckType.values()) + if (type.getParent() != null) { + eventsChecked.addPlotter(new Plotter(type.name()) { - @Override - public int getValue() { - final int checked = MetricsData.getChecked(type); - MetricsData.resetChecked(type); - return checked; - } - }); - checksFailed.addPlotter(new Plotter(type.name()) { + @Override + public int getValue() { + final int checked = MetricsData.getChecked(type); + MetricsData.resetChecked(type); + return checked; + } + }); + checksFailed.addPlotter(new Plotter(type.name()) { - @Override - public int getValue() { - final int failed = MetricsData.getFailed(type); - MetricsData.resetFailed(type); - return failed; - } - }); - violationLevels.addPlotter(new Plotter(type.name()) { + @Override + public int getValue() { + final int failed = MetricsData.getFailed(type); + MetricsData.resetFailed(type); + return failed; + } + }); + violationLevels.addPlotter(new Plotter(type.name()) { - @Override - public int getValue() { - final int violationLevel = (int) MetricsData.getViolationLevel(type); - MetricsData.resetViolationLevel(type); - return violationLevel; - } - }); - } - final Graph serverTicks = metrics.createGraph("Server Ticks"); - for (int ticks = 0; ticks < 21; ticks++) - serverTicks.addPlotter(new TicksPlotter(ticks)); - metrics.start(); - } catch (final Exception e) {} + @Override + public int getValue() { + final int violationLevel = (int) MetricsData.getViolationLevel(type); + MetricsData.resetViolationLevel(type); + return violationLevel; + } + }); + } + final Graph serverTicks = metrics.createGraph("Server Ticks"); + for (int ticks = 0; ticks < 21; ticks++) + serverTicks.addPlotter(new TicksPlotter(ticks)); + metrics.start(); + } catch (final Exception e) {} // Is a new update available? try { @@ -195,9 +203,32 @@ public class NoCheatPlus extends JavaPlugin implements Listener { @EventHandler( priority = EventPriority.LOWEST) final void onExecuteActions(final ExecuteActionsEvent event) { + /* + * _____ _ _ _ _ + * | ____|_ _____ ___ _ _| |_ ___ / \ ___| |_(_) ___ _ __ ___ + * | _| \ \/ / _ \/ __| | | | __/ _ \ / _ \ / __| __| |/ _ \| '_ \/ __| + * | |___ > < __/ (__| |_| | || __/ / ___ \ (__| |_| | (_) | | | \__ \ + * |_____/_/\_\___|\___|\__,_|\__\___| /_/ \_\___|\__|_|\___/|_| |_|___/ + */ event.executeActions(); } + public void onPlayerJoinLow(final PlayerJoinEvent event) { + /* + * ____ _ _ _ + * | _ \| | __ _ _ _ ___ _ __ | | ___ (_)_ __ + * | |_) | |/ _` | | | |/ _ \ '__| _ | |/ _ \| | '_ \ + * | __/| | (_| | |_| | __/ | | |_| | (_) | | | | | + * |_| |_|\__,_|\__, |\___|_| \___/ \___/|_|_| |_| + * |___/ + */ + // Change the NetServerHandler of the player if requested in the configuration. + final ConfigFile configFile = ConfigManager.getConfigFile(); + if (configFile.getBoolean(ConfPaths.MISCELLANEOUS_NOMOVEDTOOQUICKLY_ENABLED)) + NCPNetServerHandler.changeNetServerHandler(event.getPlayer(), + configFile.getBoolean(ConfPaths.MISCELLANEOUS_NOMOVEDTOOQUICKLY_USEPROXY)); + } + /** * This event handler is used to send all the disabling messages to the client. * @@ -206,7 +237,15 @@ public class NoCheatPlus extends JavaPlugin implements Listener { */ @EventHandler( priority = EventPriority.MONITOR) - public void onPlayerJoin(final PlayerJoinEvent event) { + public void onPlayerJoinMonitor(final PlayerJoinEvent event) { + /* + * ____ _ _ _ + * | _ \| | __ _ _ _ ___ _ __ | | ___ (_)_ __ + * | |_) | |/ _` | | | |/ _ \ '__| _ | |/ _ \| | '_ \ + * | __/| | (_| | |_| | __/ | | |_| | (_) | | | | | + * |_| |_|\__,_|\__, |\___|_| \___/ \___/|_|_| |_| + * |___/ + */ final Player player = event.getPlayer(); // Send a message to the player if a new update is available. diff --git a/src/fr/neatmonster/nocheatplus/checks/chat/ChatListener.java b/src/fr/neatmonster/nocheatplus/checks/chat/ChatListener.java index 48b2dcc7..278c5c1a 100644 --- a/src/fr/neatmonster/nocheatplus/checks/chat/ChatListener.java +++ b/src/fr/neatmonster/nocheatplus/checks/chat/ChatListener.java @@ -11,6 +11,7 @@ import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerLoginEvent.Result; import org.bukkit.event.player.PlayerMoveEvent; +import fr.neatmonster.nocheatplus.players.Permissions; import fr.neatmonster.nocheatplus.utilities.CheckUtils; /* @@ -92,7 +93,7 @@ public class ChatListener implements Listener { if (ChatConfig.getConfig(player).protectPlugins) if ((command.equalsIgnoreCase("plugins") || command.equalsIgnoreCase("pl") || command.equalsIgnoreCase("version") || command.equalsIgnoreCase("ver")) - && !player.isOp()) { + && !player.hasPermission(Permissions.ADMINISTRATION_PLUGINS)) { event.getPlayer().sendMessage( ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. " + "Please contact the server administrators if you believe that this is in error."); diff --git a/src/fr/neatmonster/nocheatplus/config/ConfPaths.java b/src/fr/neatmonster/nocheatplus/config/ConfPaths.java index a7301902..336e9b4b 100644 --- a/src/fr/neatmonster/nocheatplus/config/ConfPaths.java +++ b/src/fr/neatmonster/nocheatplus/config/ConfPaths.java @@ -23,13 +23,13 @@ public abstract class ConfPaths { * , 88P , 88P , 88P * "8",P" "8",P" "8",P" */ - private static final String LOGGING = "logging."; - public static final String LOGGING_ACTIVE = LOGGING + "active"; - public static final String LOGGING_CONSOLE = LOGGING + "console"; - public static final String LOGGING_DEBUG = LOGGING + "debug"; - public static final String LOGGING_FILE = LOGGING + "file"; - public static final String LOGGING_FILENAME = LOGGING + "filename"; - public static final String LOGGING_INGAMECHAT = LOGGING + "ingamechat"; + private static final String LOGGING = "logging."; + public static final String LOGGING_ACTIVE = LOGGING + "active"; + public static final String LOGGING_CONSOLE = LOGGING + "console"; + public static final String LOGGING_DEBUG = LOGGING + "debug"; + public static final String LOGGING_FILE = LOGGING + "file"; + public static final String LOGGING_FILENAME = LOGGING + "filename"; + public static final String LOGGING_INGAMECHAT = LOGGING + "ingamechat"; /* * e e ,e, 888 888 @@ -38,13 +38,17 @@ public abstract class ConfPaths { * d8b Y8b Y8b 888 Y88D Y888 , 888 , 888 888 ,ee 888 888 888 888 , Y888 888P Y888 888P Y88D * d888b Y8b Y8b 888 d,dP "88,e8' "YeeP" 888 888 "88 888 888 888 "YeeP" "88 88" "88 88" d,dP */ - private static final String MISCELLANEOUS = "miscellaneous."; - public static final String MISCELLANEOUS_ALLOWCLIENTMODS = MISCELLANEOUS + "allowclientmods"; - public static final String MISCELLANEOUS_NOMOVEDTOOQUICKLY = MISCELLANEOUS + "nomovedtooquickly"; - public static final String MISCELLANEOUS_OPINCONSOLEONLY = MISCELLANEOUS + "opinconsoleonly"; - public static final String MISCELLANEOUS_PROTECTPLUGINS = MISCELLANEOUS + "protectplugins"; + private static final String MISCELLANEOUS = "miscellaneous."; + public static final String MISCELLANEOUS_ALLOWCLIENTMODS = MISCELLANEOUS + "allowclientmods"; + public static final String MISCELLANEOUS_OPINCONSOLEONLY = MISCELLANEOUS + "opinconsoleonly"; + public static final String MISCELLANEOUS_PROTECTPLUGINS = MISCELLANEOUS + "protectplugins"; + public static final String MISCELLANEOUS_REPORTTOMETRICS = MISCELLANEOUS + "reporttometrics"; - private static final String CHECKS = "checks."; + private static final String MISCELLANEOUS_NOMOVEDTOOQUICKLY = MISCELLANEOUS + "nomovedtooquickly."; + public static final String MISCELLANEOUS_NOMOVEDTOOQUICKLY_ENABLED = MISCELLANEOUS_NOMOVEDTOOQUICKLY + "enabled"; + public static final String MISCELLANEOUS_NOMOVEDTOOQUICKLY_USEPROXY = MISCELLANEOUS_NOMOVEDTOOQUICKLY + "useproxy"; + + private static final String CHECKS = "checks."; /* * 888 88b, 888 888 888 88b, 888 @@ -53,25 +57,25 @@ public abstract class ConfPaths { * 888 88b, 888 Y888 888P Y888 , 888 b 888 88b, 888 888 , ,ee 888 888 b * 888 88P' 888 "88 88" "88,e8' 888 8b 888 88P' 888 "YeeP" "88 888 888 8b */ - private static final String BLOCKBREAK = CHECKS + "blockbreak."; + private static final String BLOCKBREAK = CHECKS + "blockbreak."; - private static final String BLOCKBREAK_DIRECTION = BLOCKBREAK + "direction."; - public static final String BLOCKBREAK_DIRECTION_CHECK = BLOCKBREAK_DIRECTION + "active"; - public static final String BLOCKBREAK_DIRECTION_ACTIONS = BLOCKBREAK_DIRECTION + "actions"; + private static final String BLOCKBREAK_DIRECTION = BLOCKBREAK + "direction."; + public static final String BLOCKBREAK_DIRECTION_CHECK = BLOCKBREAK_DIRECTION + "active"; + public static final String BLOCKBREAK_DIRECTION_ACTIONS = BLOCKBREAK_DIRECTION + "actions"; - private static final String BLOCKBREAK_FASTBREAK = BLOCKBREAK + "fastbreak."; - public static final String BLOCKBREAK_FASTBREAK_CHECK = BLOCKBREAK_FASTBREAK + "active"; - public static final String BLOCKBREAK_FASTBREAK_BUFFER = BLOCKBREAK_FASTBREAK + "buffer"; - public static final String BLOCKBREAK_FASTBREAK_INTERVAL = BLOCKBREAK_FASTBREAK + "interval"; - public static final String BLOCKBREAK_FASTBREAK_ACTIONS = BLOCKBREAK_FASTBREAK + "actions"; + private static final String BLOCKBREAK_FASTBREAK = BLOCKBREAK + "fastbreak."; + public static final String BLOCKBREAK_FASTBREAK_CHECK = BLOCKBREAK_FASTBREAK + "active"; + public static final String BLOCKBREAK_FASTBREAK_BUFFER = BLOCKBREAK_FASTBREAK + "buffer"; + public static final String BLOCKBREAK_FASTBREAK_INTERVAL = BLOCKBREAK_FASTBREAK + "interval"; + public static final String BLOCKBREAK_FASTBREAK_ACTIONS = BLOCKBREAK_FASTBREAK + "actions"; - private static final String BLOCKBREAK_NOSWING = BLOCKBREAK + "noswing."; - public static final String BLOCKBREAK_NOSWING_CHECK = BLOCKBREAK_NOSWING + "active"; - public static final String BLOCKBREAK_NOSWING_ACTIONS = BLOCKBREAK_NOSWING + "actions"; + private static final String BLOCKBREAK_NOSWING = BLOCKBREAK + "noswing."; + public static final String BLOCKBREAK_NOSWING_CHECK = BLOCKBREAK_NOSWING + "active"; + public static final String BLOCKBREAK_NOSWING_ACTIONS = BLOCKBREAK_NOSWING + "actions"; - private static final String BLOCKBREAK_REACH = BLOCKBREAK + "reach."; - public static final String BLOCKBREAK_REACH_CHECK = BLOCKBREAK_REACH + "active"; - public static final String BLOCKBREAK_REACH_ACTIONS = BLOCKBREAK_REACH + "actions"; + private static final String BLOCKBREAK_REACH = BLOCKBREAK + "reach."; + public static final String BLOCKBREAK_REACH_CHECK = BLOCKBREAK_REACH + "active"; + public static final String BLOCKBREAK_REACH_ACTIONS = BLOCKBREAK_REACH + "actions"; /* * 888 88b, 888 888 888 d8 d8 @@ -80,15 +84,15 @@ public abstract class ConfPaths { * 888 88b, 888 Y888 888P Y888 , 888 b 888 888 888 888 888 , 888 ,ee 888 Y888 , 888 * 888 88P' 888 "88 88" "88,e8' 888 8b 888 888 888 888 "YeeP" 888 "88 888 "88,e8' 888 */ - private static final String BLOCKINTERACT = CHECKS + "blockinteract."; + private static final String BLOCKINTERACT = CHECKS + "blockinteract."; - private static final String BLOCKINTERACT_DIRECTION = BLOCKINTERACT + "direction."; - public static final String BLOCKINTERACT_DIRECTION_CHECK = BLOCKINTERACT_DIRECTION + "active"; - public static final String BLOCKINTERACT_DIRECTION_ACTIONS = BLOCKINTERACT_DIRECTION + "actions"; + private static final String BLOCKINTERACT_DIRECTION = BLOCKINTERACT + "direction."; + public static final String BLOCKINTERACT_DIRECTION_CHECK = BLOCKINTERACT_DIRECTION + "active"; + public static final String BLOCKINTERACT_DIRECTION_ACTIONS = BLOCKINTERACT_DIRECTION + "actions"; - private static final String BLOCKINTERACT_REACH = BLOCKINTERACT + "reach."; - public static final String BLOCKINTERACT_REACH_CHECK = BLOCKINTERACT_REACH + "active"; - public static final String BLOCKINTERACT_REACH_ACTIONS = BLOCKINTERACT_REACH + "actions"; + private static final String BLOCKINTERACT_REACH = BLOCKINTERACT + "reach."; + public static final String BLOCKINTERACT_REACH_CHECK = BLOCKINTERACT_REACH + "active"; + public static final String BLOCKINTERACT_REACH_ACTIONS = BLOCKINTERACT_REACH + "actions"; /* * 888 88b, 888 888 888 88e 888 @@ -97,30 +101,30 @@ public abstract class ConfPaths { * 888 88b, 888 Y888 888P Y888 , 888 b 888 888 ,ee 888 Y888 , 888 , * 888 88P' 888 "88 88" "88,e8' 888 8b 888 888 "88 888 "88,e8' "YeeP" */ - private static final String BLOCKPLACE = CHECKS + "blockplace."; + private static final String BLOCKPLACE = CHECKS + "blockplace."; - private static final String BLOCKPLACE_DIRECTION = BLOCKPLACE + "direction."; - public static final String BLOCKPLACE_DIRECTION_CHECK = BLOCKPLACE_DIRECTION + "active"; - public static final String BLOCKPLACE_DIRECTION_ACTIONS = BLOCKPLACE_DIRECTION + "actions"; + private static final String BLOCKPLACE_DIRECTION = BLOCKPLACE + "direction."; + public static final String BLOCKPLACE_DIRECTION_CHECK = BLOCKPLACE_DIRECTION + "active"; + public static final String BLOCKPLACE_DIRECTION_ACTIONS = BLOCKPLACE_DIRECTION + "actions"; - private static final String BLOCKPLACE_FASTPLACE = BLOCKPLACE + "fastplace."; - public static final String BLOCKPLACE_FASTPLACE_CHECK = BLOCKPLACE_FASTPLACE + "active"; - public static final String BLOCKPLACE_FASTPLACE_EXPERIMENTAL = BLOCKPLACE_FASTPLACE + "experimental"; - public static final String BLOCKPLACE_FASTPLACE_INTERVAL = BLOCKPLACE_FASTPLACE + "interval"; - public static final String BLOCKPLACE_FASTPLACE_ACTIONS = BLOCKPLACE_FASTPLACE + "actions"; + private static final String BLOCKPLACE_FASTPLACE = BLOCKPLACE + "fastplace."; + public static final String BLOCKPLACE_FASTPLACE_CHECK = BLOCKPLACE_FASTPLACE + "active"; + public static final String BLOCKPLACE_FASTPLACE_EXPERIMENTAL = BLOCKPLACE_FASTPLACE + "experimental"; + public static final String BLOCKPLACE_FASTPLACE_INTERVAL = BLOCKPLACE_FASTPLACE + "interval"; + public static final String BLOCKPLACE_FASTPLACE_ACTIONS = BLOCKPLACE_FASTPLACE + "actions"; - private static final String BLOCKPLACE_NOSWING = BLOCKPLACE + "noswing."; - public static final String BLOCKPLACE_NOSWING_CHECK = BLOCKPLACE_NOSWING + "active"; - public static final String BLOCKPLACE_NOSWING_ACTIONS = BLOCKPLACE_NOSWING + "actions"; + private static final String BLOCKPLACE_NOSWING = BLOCKPLACE + "noswing."; + public static final String BLOCKPLACE_NOSWING_CHECK = BLOCKPLACE_NOSWING + "active"; + public static final String BLOCKPLACE_NOSWING_ACTIONS = BLOCKPLACE_NOSWING + "actions"; - private static final String BLOCKPLACE_REACH = BLOCKPLACE + "reach."; - public static final String BLOCKPLACE_REACH_CHECK = BLOCKPLACE_REACH + "active"; - public static final String BLOCKPLACE_REACH_ACTIONS = BLOCKPLACE_REACH + "actions"; + private static final String BLOCKPLACE_REACH = BLOCKPLACE + "reach."; + public static final String BLOCKPLACE_REACH_CHECK = BLOCKPLACE_REACH + "active"; + public static final String BLOCKPLACE_REACH_ACTIONS = BLOCKPLACE_REACH + "actions"; - private static final String BLOCKPLACE_SPEED = BLOCKPLACE + "speed."; - public static final String BLOCKPLACE_SPEED_CHECK = BLOCKPLACE_SPEED + "active"; - public static final String BLOCKPLACE_SPEED_INTERVAL = BLOCKPLACE_SPEED + "interval"; - public static final String BLOCKPLACE_SPEED_ACTIONS = BLOCKPLACE_SPEED + "actions"; + private static final String BLOCKPLACE_SPEED = BLOCKPLACE + "speed."; + public static final String BLOCKPLACE_SPEED_CHECK = BLOCKPLACE_SPEED + "active"; + public static final String BLOCKPLACE_SPEED_INTERVAL = BLOCKPLACE_SPEED + "interval"; + public static final String BLOCKPLACE_SPEED_ACTIONS = BLOCKPLACE_SPEED + "actions"; /* * e88'Y88 888 d8 @@ -129,79 +133,79 @@ public abstract class ConfPaths { * Y888 ,d 888 888 ,ee 888 888 * "88,d88 888 888 "88 888 888 */ - private static final String CHAT = CHECKS + "chat."; + private static final String CHAT = CHECKS + "chat."; - private static final String CHAT_COLOR = CHAT + "color."; - public static final String CHAT_COLOR_CHECK = CHAT_COLOR + "active"; - public static final String CHAT_COLOR_ACTIONS = CHAT_COLOR + "actions"; + private static final String CHAT_COLOR = CHAT + "color."; + public static final String CHAT_COLOR_CHECK = CHAT_COLOR + "active"; + public static final String CHAT_COLOR_ACTIONS = CHAT_COLOR + "actions"; - private static final String CHAT_NOPWNAGE = CHAT + "nopwnage."; - public static final String CHAT_NOPWNAGE_CHECK = CHAT_NOPWNAGE + "active"; - public static final String CHAT_NOPWNAGE_EXCLUSIONS = CHAT_NOPWNAGE + "exclusions"; - public static final String CHAT_NOPWNAGE_LEVEL = CHAT_NOPWNAGE + "level"; - public static final String CHAT_NOPWNAGE_KICKMESSAGE = CHAT_NOPWNAGE + "kickmessage"; + private static final String CHAT_NOPWNAGE = CHAT + "nopwnage."; + public static final String CHAT_NOPWNAGE_CHECK = CHAT_NOPWNAGE + "active"; + public static final String CHAT_NOPWNAGE_EXCLUSIONS = CHAT_NOPWNAGE + "exclusions"; + public static final String CHAT_NOPWNAGE_LEVEL = CHAT_NOPWNAGE + "level"; + public static final String CHAT_NOPWNAGE_KICKMESSAGE = CHAT_NOPWNAGE + "kickmessage"; - private static final String CHAT_NOPWNAGE_BANNED = CHAT_NOPWNAGE + "banned."; - public static final String CHAT_NOPWNAGE_BANNED_CHECK = CHAT_NOPWNAGE_BANNED + "active"; - public static final String CHAT_NOPWNAGE_BANNED_TIMEOUT = CHAT_NOPWNAGE_BANNED + "timeout"; - public static final String CHAT_NOPWNAGE_BANNED_WEIGHT = CHAT_NOPWNAGE_BANNED + "weight"; + private static final String CHAT_NOPWNAGE_BANNED = CHAT_NOPWNAGE + "banned."; + public static final String CHAT_NOPWNAGE_BANNED_CHECK = CHAT_NOPWNAGE_BANNED + "active"; + public static final String CHAT_NOPWNAGE_BANNED_TIMEOUT = CHAT_NOPWNAGE_BANNED + "timeout"; + public static final String CHAT_NOPWNAGE_BANNED_WEIGHT = CHAT_NOPWNAGE_BANNED + "weight"; - private static final String CHAT_NOPWNAGE_CAPTCHA = CHAT_NOPWNAGE + "captcha."; - public static final String CHAT_NOPWNAGE_CAPTCHA_CHECK = CHAT_NOPWNAGE_CAPTCHA + "active"; - public static final String CHAT_NOPWNAGE_CAPTCHA_CHARACTERS = CHAT_NOPWNAGE_CAPTCHA + "characters"; - public static final String CHAT_NOPWNAGE_CAPTCHA_LENGTH = CHAT_NOPWNAGE_CAPTCHA + "length"; - public static final String CHAT_NOPWNAGE_CAPTCHA_QUESTION = CHAT_NOPWNAGE_CAPTCHA + "question"; - public static final String CHAT_NOPWNAGE_CAPTCHA_SUCCESS = CHAT_NOPWNAGE_CAPTCHA + "success"; - public static final String CHAT_NOPWNAGE_CAPTCHA_TRIES = CHAT_NOPWNAGE_CAPTCHA + "tries"; + private static final String CHAT_NOPWNAGE_CAPTCHA = CHAT_NOPWNAGE + "captcha."; + public static final String CHAT_NOPWNAGE_CAPTCHA_CHECK = CHAT_NOPWNAGE_CAPTCHA + "active"; + public static final String CHAT_NOPWNAGE_CAPTCHA_CHARACTERS = CHAT_NOPWNAGE_CAPTCHA + "characters"; + public static final String CHAT_NOPWNAGE_CAPTCHA_LENGTH = CHAT_NOPWNAGE_CAPTCHA + "length"; + public static final String CHAT_NOPWNAGE_CAPTCHA_QUESTION = CHAT_NOPWNAGE_CAPTCHA + "question"; + public static final String CHAT_NOPWNAGE_CAPTCHA_SUCCESS = CHAT_NOPWNAGE_CAPTCHA + "success"; + public static final String CHAT_NOPWNAGE_CAPTCHA_TRIES = CHAT_NOPWNAGE_CAPTCHA + "tries"; - private static final String CHAT_NOPWNAGE_FIRST = CHAT_NOPWNAGE + "first."; - public static final String CHAT_NOPWNAGE_FIRST_CHECK = CHAT_NOPWNAGE_FIRST + "active"; - public static final String CHAT_NOPWNAGE_FIRST_TIMEOUT = CHAT_NOPWNAGE_FIRST + "timeout"; - public static final String CHAT_NOPWNAGE_FIRST_WEIGHT = CHAT_NOPWNAGE_FIRST + "weight"; + private static final String CHAT_NOPWNAGE_FIRST = CHAT_NOPWNAGE + "first."; + public static final String CHAT_NOPWNAGE_FIRST_CHECK = CHAT_NOPWNAGE_FIRST + "active"; + public static final String CHAT_NOPWNAGE_FIRST_TIMEOUT = CHAT_NOPWNAGE_FIRST + "timeout"; + public static final String CHAT_NOPWNAGE_FIRST_WEIGHT = CHAT_NOPWNAGE_FIRST + "weight"; - private static final String CHAT_NOPWNAGE_GLOBAL = CHAT_NOPWNAGE + "global."; - public static final String CHAT_NOPWNAGE_GLOBAL_CHECK = CHAT_NOPWNAGE_GLOBAL + "active"; - public static final String CHAT_NOPWNAGE_GLOBAL_TIMEOUT = CHAT_NOPWNAGE_GLOBAL + "timeout"; - public static final String CHAT_NOPWNAGE_GLOBAL_WEIGHT = CHAT_NOPWNAGE_GLOBAL + "weight"; + private static final String CHAT_NOPWNAGE_GLOBAL = CHAT_NOPWNAGE + "global."; + public static final String CHAT_NOPWNAGE_GLOBAL_CHECK = CHAT_NOPWNAGE_GLOBAL + "active"; + public static final String CHAT_NOPWNAGE_GLOBAL_TIMEOUT = CHAT_NOPWNAGE_GLOBAL + "timeout"; + public static final String CHAT_NOPWNAGE_GLOBAL_WEIGHT = CHAT_NOPWNAGE_GLOBAL + "weight"; - private static final String CHAT_NOPWNAGE_MOVE = CHAT_NOPWNAGE + "move."; - public static final String CHAT_NOPWNAGE_MOVE_CHECK = CHAT_NOPWNAGE_MOVE + "active"; - public static final String CHAT_NOPWNAGE_MOVE_TIMEOUT = CHAT_NOPWNAGE_MOVE + "timeout"; - public static final String CHAT_NOPWNAGE_MOVE_WEIGHT = CHAT_NOPWNAGE_MOVE + "weight"; + private static final String CHAT_NOPWNAGE_MOVE = CHAT_NOPWNAGE + "move."; + public static final String CHAT_NOPWNAGE_MOVE_CHECK = CHAT_NOPWNAGE_MOVE + "active"; + public static final String CHAT_NOPWNAGE_MOVE_TIMEOUT = CHAT_NOPWNAGE_MOVE + "timeout"; + public static final String CHAT_NOPWNAGE_MOVE_WEIGHT = CHAT_NOPWNAGE_MOVE + "weight"; - private static final String CHAT_NOPWNAGE_RELOGIN = CHAT_NOPWNAGE + "relogin."; - public static final String CHAT_NOPWNAGE_RELOGIN_CHECK = CHAT_NOPWNAGE_RELOGIN + "active"; - public static final String CHAT_NOPWNAGE_RELOGIN_KICKMESSAGE = CHAT_NOPWNAGE_RELOGIN + "kickmessage"; - public static final String CHAT_NOPWNAGE_RELOGIN_TIMEOUT = CHAT_NOPWNAGE_RELOGIN + "timeout"; + private static final String CHAT_NOPWNAGE_RELOGIN = CHAT_NOPWNAGE + "relogin."; + public static final String CHAT_NOPWNAGE_RELOGIN_CHECK = CHAT_NOPWNAGE_RELOGIN + "active"; + public static final String CHAT_NOPWNAGE_RELOGIN_KICKMESSAGE = CHAT_NOPWNAGE_RELOGIN + "kickmessage"; + public static final String CHAT_NOPWNAGE_RELOGIN_TIMEOUT = CHAT_NOPWNAGE_RELOGIN + "timeout"; - private static final String CHAT_NOPWNAGE_RELOGIN_WARNING = CHAT_NOPWNAGE_RELOGIN + "warning."; - public static final String CHAT_NOPWNAGE_RELOGIN_WARNING_MESSAGE = CHAT_NOPWNAGE_RELOGIN_WARNING + "message"; - public static final String CHAT_NOPWNAGE_RELOGIN_WARNING_NUMBER = CHAT_NOPWNAGE_RELOGIN_WARNING + "number"; - public static final String CHAT_NOPWNAGE_RELOGIN_WARNING_TIMEOUT = CHAT_NOPWNAGE_RELOGIN_WARNING + "timeout"; + private static final String CHAT_NOPWNAGE_RELOGIN_WARNING = CHAT_NOPWNAGE_RELOGIN + "warning."; + public static final String CHAT_NOPWNAGE_RELOGIN_WARNING_MESSAGE = CHAT_NOPWNAGE_RELOGIN_WARNING + "message"; + public static final String CHAT_NOPWNAGE_RELOGIN_WARNING_NUMBER = CHAT_NOPWNAGE_RELOGIN_WARNING + "number"; + public static final String CHAT_NOPWNAGE_RELOGIN_WARNING_TIMEOUT = CHAT_NOPWNAGE_RELOGIN_WARNING + "timeout"; - private static final String CHAT_NOPWNAGE_REPEAT = CHAT_NOPWNAGE + "repeat."; - public static final String CHAT_NOPWNAGE_REPEAT_CHECK = CHAT_NOPWNAGE_REPEAT + "active"; - public static final String CHAT_NOPWNAGE_REPEAT_TIMEOUT = CHAT_NOPWNAGE_REPEAT + "timeout"; - public static final String CHAT_NOPWNAGE_REPEAT_WEIGHT = CHAT_NOPWNAGE_REPEAT + "weight"; + private static final String CHAT_NOPWNAGE_REPEAT = CHAT_NOPWNAGE + "repeat."; + public static final String CHAT_NOPWNAGE_REPEAT_CHECK = CHAT_NOPWNAGE_REPEAT + "active"; + public static final String CHAT_NOPWNAGE_REPEAT_TIMEOUT = CHAT_NOPWNAGE_REPEAT + "timeout"; + public static final String CHAT_NOPWNAGE_REPEAT_WEIGHT = CHAT_NOPWNAGE_REPEAT + "weight"; - private static final String CHAT_NOPWNAGE_SPEED = CHAT_NOPWNAGE + "speed."; - public static final String CHAT_NOPWNAGE_SPEED_CHECK = CHAT_NOPWNAGE_SPEED + "active"; - public static final String CHAT_NOPWNAGE_SPEED_TIMEOUT = CHAT_NOPWNAGE_SPEED + "timeout"; - public static final String CHAT_NOPWNAGE_SPEED_WEIGHT = CHAT_NOPWNAGE_SPEED + "weight"; + private static final String CHAT_NOPWNAGE_SPEED = CHAT_NOPWNAGE + "speed."; + public static final String CHAT_NOPWNAGE_SPEED_CHECK = CHAT_NOPWNAGE_SPEED + "active"; + public static final String CHAT_NOPWNAGE_SPEED_TIMEOUT = CHAT_NOPWNAGE_SPEED + "timeout"; + public static final String CHAT_NOPWNAGE_SPEED_WEIGHT = CHAT_NOPWNAGE_SPEED + "weight"; - private static final String CHAT_NOPWNAGE_WARN = CHAT_NOPWNAGE + "warn."; - public static final String CHAT_NOPWNAGE_WARN_LEVEL = CHAT_NOPWNAGE_WARN + "level"; - public static final String CHAT_NOPWNAGE_WARN_TIMEOUT = CHAT_NOPWNAGE_WARN + "timeout"; + private static final String CHAT_NOPWNAGE_WARN = CHAT_NOPWNAGE + "warn."; + public static final String CHAT_NOPWNAGE_WARN_LEVEL = CHAT_NOPWNAGE_WARN + "level"; + public static final String CHAT_NOPWNAGE_WARN_TIMEOUT = CHAT_NOPWNAGE_WARN + "timeout"; - private static final String CHAT_NOPWNAGE_WARN_OTHERS = CHAT_NOPWNAGE_WARN + "others."; - public static final String CHAT_NOPWNAGE_WARN_OTHERS_CHECK = CHAT_NOPWNAGE_WARN_OTHERS + "active"; - public static final String CHAT_NOPWNAGE_WARN_OTHERS_MESSAGE = CHAT_NOPWNAGE_WARN_OTHERS + "message"; + private static final String CHAT_NOPWNAGE_WARN_OTHERS = CHAT_NOPWNAGE_WARN + "others."; + public static final String CHAT_NOPWNAGE_WARN_OTHERS_CHECK = CHAT_NOPWNAGE_WARN_OTHERS + "active"; + public static final String CHAT_NOPWNAGE_WARN_OTHERS_MESSAGE = CHAT_NOPWNAGE_WARN_OTHERS + "message"; - private static final String CHAT_NOPWNAGE_WARN_PLAYER = CHAT_NOPWNAGE_WARN + "player."; - public static final String CHAT_NOPWNAGE_WARN_PLAYER_CHECK = CHAT_NOPWNAGE_WARN_PLAYER + "active"; - public static final String CHAT_NOPWNAGE_WARN_PLAYER_MESSAGE = CHAT_NOPWNAGE_WARN_PLAYER + "message"; + private static final String CHAT_NOPWNAGE_WARN_PLAYER = CHAT_NOPWNAGE_WARN + "player."; + public static final String CHAT_NOPWNAGE_WARN_PLAYER_CHECK = CHAT_NOPWNAGE_WARN_PLAYER + "active"; + public static final String CHAT_NOPWNAGE_WARN_PLAYER_MESSAGE = CHAT_NOPWNAGE_WARN_PLAYER + "message"; - public static final String CHAT_NOPWNAGE_ACTIONS = CHAT_NOPWNAGE + "actions"; + public static final String CHAT_NOPWNAGE_ACTIONS = CHAT_NOPWNAGE + "actions"; /* * 888'Y88 ,e, 888 d8 @@ -212,50 +216,50 @@ public abstract class ConfPaths { * , 88P * "8",P" */ - private static final String FIGHT = CHECKS + "fight."; + private static final String FIGHT = CHECKS + "fight."; - private static final String FIGHT_ANGLE = FIGHT + "angle."; - public static final String FIGHT_ANGLE_CHECK = FIGHT_ANGLE + "active"; - public static final String FIGHT_ANGLE_THRESHOLD = FIGHT_ANGLE + "threshold"; - public static final String FIGHT_ANGLE_ACTIONS = FIGHT_ANGLE + "actions"; + private static final String FIGHT_ANGLE = FIGHT + "angle."; + public static final String FIGHT_ANGLE_CHECK = FIGHT_ANGLE + "active"; + public static final String FIGHT_ANGLE_THRESHOLD = FIGHT_ANGLE + "threshold"; + public static final String FIGHT_ANGLE_ACTIONS = FIGHT_ANGLE + "actions"; - private static final String FIGHT_CRITICAL = FIGHT + "critical."; - public static final String FIGHT_CRITICAL_CHECK = FIGHT_CRITICAL + "active"; - public static final String FIGHT_CRITICAL_FALLDISTANCE = FIGHT_CRITICAL + "falldistance"; - public static final String FIGHT_CRITICAL_VELOCITY = FIGHT_CRITICAL + "velocity"; - public static final String FIGHT_CRITICAL_ACTIONS = FIGHT_CRITICAL + "actions"; + private static final String FIGHT_CRITICAL = FIGHT + "critical."; + public static final String FIGHT_CRITICAL_CHECK = FIGHT_CRITICAL + "active"; + public static final String FIGHT_CRITICAL_FALLDISTANCE = FIGHT_CRITICAL + "falldistance"; + public static final String FIGHT_CRITICAL_VELOCITY = FIGHT_CRITICAL + "velocity"; + public static final String FIGHT_CRITICAL_ACTIONS = FIGHT_CRITICAL + "actions"; - private static final String FIGHT_DIRECTION = FIGHT + "direction."; - public static final String FIGHT_DIRECTION_CHECK = FIGHT_DIRECTION + "active"; - public static final String FIGHT_DIRECTION_PENALTY = FIGHT_DIRECTION + "penalty"; - public static final String FIGHT_DIRECTION_ACTIONS = FIGHT_DIRECTION + "actions"; + private static final String FIGHT_DIRECTION = FIGHT + "direction."; + public static final String FIGHT_DIRECTION_CHECK = FIGHT_DIRECTION + "active"; + public static final String FIGHT_DIRECTION_PENALTY = FIGHT_DIRECTION + "penalty"; + public static final String FIGHT_DIRECTION_ACTIONS = FIGHT_DIRECTION + "actions"; - private static final String FIGHT_GODMODE = FIGHT + "godmode."; - public static final String FIGHT_GODMODE_CHECK = FIGHT_GODMODE + "active"; - public static final String FIGHT_GODMODE_ACTIONS = FIGHT_GODMODE + "actions"; + private static final String FIGHT_GODMODE = FIGHT + "godmode."; + public static final String FIGHT_GODMODE_CHECK = FIGHT_GODMODE + "active"; + public static final String FIGHT_GODMODE_ACTIONS = FIGHT_GODMODE + "actions"; - private static final String FIGHT_INSTANTHEAL = FIGHT + "instantheal."; - public static final String FIGHT_INSTANTHEAL_CHECK = FIGHT_INSTANTHEAL + "active"; - public static final String FIGHT_INSTANTHEAL_ACTIONS = FIGHT_INSTANTHEAL + "actions"; + private static final String FIGHT_INSTANTHEAL = FIGHT + "instantheal."; + public static final String FIGHT_INSTANTHEAL_CHECK = FIGHT_INSTANTHEAL + "active"; + public static final String FIGHT_INSTANTHEAL_ACTIONS = FIGHT_INSTANTHEAL + "actions"; - private static final String FIGHT_KNOCKBACK = FIGHT + "knockback."; - public static final String FIGHT_KNOCKBACK_CHECK = FIGHT_KNOCKBACK + "active"; - public static final String FIGHT_KNOCKBACK_INTERVAL = FIGHT_KNOCKBACK + "interval"; - public static final String FIGHT_KNOCKBACK_ACTIONS = FIGHT_KNOCKBACK + "actions"; + private static final String FIGHT_KNOCKBACK = FIGHT + "knockback."; + public static final String FIGHT_KNOCKBACK_CHECK = FIGHT_KNOCKBACK + "active"; + public static final String FIGHT_KNOCKBACK_INTERVAL = FIGHT_KNOCKBACK + "interval"; + public static final String FIGHT_KNOCKBACK_ACTIONS = FIGHT_KNOCKBACK + "actions"; - private static final String FIGHT_NOSWING = FIGHT + "noswing."; - public static final String FIGHT_NOSWING_CHECK = FIGHT_NOSWING + "active"; - public static final String FIGHT_NOSWING_ACTIONS = FIGHT_NOSWING + "actions"; + private static final String FIGHT_NOSWING = FIGHT + "noswing."; + public static final String FIGHT_NOSWING_CHECK = FIGHT_NOSWING + "active"; + public static final String FIGHT_NOSWING_ACTIONS = FIGHT_NOSWING + "actions"; - private static final String FIGHT_REACH = FIGHT + "reach."; - public static final String FIGHT_REACH_CHECK = FIGHT_REACH + "active"; - public static final String FIGHT_REACH_PENALTY = FIGHT_REACH + "penalty"; - public static final String FIGHT_REACH_ACTIONS = FIGHT_REACH + "actions"; + private static final String FIGHT_REACH = FIGHT + "reach."; + public static final String FIGHT_REACH_CHECK = FIGHT_REACH + "active"; + public static final String FIGHT_REACH_PENALTY = FIGHT_REACH + "penalty"; + public static final String FIGHT_REACH_ACTIONS = FIGHT_REACH + "actions"; - private static final String FIGHT_SPEED = FIGHT + "speed."; - public static final String FIGHT_SPEED_CHECK = FIGHT_SPEED + "active"; - public static final String FIGHT_SPEED_LIMIT = FIGHT_SPEED + "limit"; - public static final String FIGHT_SPEED_ACTIONS = FIGHT_SPEED + "actions"; + private static final String FIGHT_SPEED = FIGHT + "speed."; + public static final String FIGHT_SPEED_CHECK = FIGHT_SPEED + "active"; + public static final String FIGHT_SPEED_LIMIT = FIGHT_SPEED + "limit"; + public static final String FIGHT_SPEED_ACTIONS = FIGHT_SPEED + "actions"; /* * 888 d8 @@ -266,25 +270,25 @@ public abstract class ConfPaths { * 888 * 888 */ - private static final String INVENTORY = CHECKS + "inventory."; + private static final String INVENTORY = CHECKS + "inventory."; - private static final String INVENTORY_DROP = INVENTORY + "drop."; - public static final String INVENTORY_DROP_CHECK = INVENTORY_DROP + "active"; - public static final String INVENTORY_DROP_LIMIT = INVENTORY_DROP + "limit"; - public static final String INVENTORY_DROP_TIMEFRAME = INVENTORY_DROP + "timeframe"; - public static final String INVENTORY_DROP_ACTIONS = INVENTORY_DROP + "actions"; + private static final String INVENTORY_DROP = INVENTORY + "drop."; + public static final String INVENTORY_DROP_CHECK = INVENTORY_DROP + "active"; + public static final String INVENTORY_DROP_LIMIT = INVENTORY_DROP + "limit"; + public static final String INVENTORY_DROP_TIMEFRAME = INVENTORY_DROP + "timeframe"; + public static final String INVENTORY_DROP_ACTIONS = INVENTORY_DROP + "actions"; - private static final String INVENTORY_FASTCLICK = INVENTORY + "fastclick."; - public static final String INVENTORY_FASTCLICK_CHECK = INVENTORY_FASTCLICK + "active"; - public static final String INVENTORY_FASTCLICK_ACTIONS = INVENTORY_FASTCLICK + "actions"; + private static final String INVENTORY_FASTCLICK = INVENTORY + "fastclick."; + public static final String INVENTORY_FASTCLICK_CHECK = INVENTORY_FASTCLICK + "active"; + public static final String INVENTORY_FASTCLICK_ACTIONS = INVENTORY_FASTCLICK + "actions"; - private static final String INVENTORY_INSTANTBOW = INVENTORY + "instantbow."; - public static final String INVENTORY_INSTANTBOW_CHECK = INVENTORY_INSTANTBOW + "active"; - public static final String INVENTORY_INSTANTBOW_ACTIONS = INVENTORY_INSTANTBOW + "actions"; + private static final String INVENTORY_INSTANTBOW = INVENTORY + "instantbow."; + public static final String INVENTORY_INSTANTBOW_CHECK = INVENTORY_INSTANTBOW + "active"; + public static final String INVENTORY_INSTANTBOW_ACTIONS = INVENTORY_INSTANTBOW + "actions"; - private static final String INVENTORY_INSTANTEAT = INVENTORY + "instanteat."; - public static final String INVENTORY_INSTANTEAT_CHECK = INVENTORY_INSTANTEAT + "active"; - public static final String INVENTORY_INSTANTEAT_ACTIONS = INVENTORY_INSTANTEAT + "actions"; + private static final String INVENTORY_INSTANTEAT = INVENTORY + "instanteat."; + public static final String INVENTORY_INSTANTEAT_CHECK = INVENTORY_INSTANTEAT + "active"; + public static final String INVENTORY_INSTANTEAT_ACTIONS = INVENTORY_INSTANTEAT + "actions"; /* * e e ,e, @@ -295,35 +299,35 @@ public abstract class ConfPaths { * , 88P * "8",P" */ - private static final String MOVING = CHECKS + "moving."; + private static final String MOVING = CHECKS + "moving."; - private static final String MOVING_CREATIVEFLY = MOVING + "creativefly."; - public static final String MOVING_CREATIVEFLY_CHECK = MOVING_CREATIVEFLY + "active"; - public static final String MOVING_CREATIVEFLY_HORIZONTALSPEED = MOVING_CREATIVEFLY + "horizontalspeed"; - public static final String MOVING_CREATIVEFLY_MAXHEIGHT = MOVING_CREATIVEFLY + "maxheight"; - public static final String MOVING_CREATIVEFLY_VERTICALSPEED = MOVING_CREATIVEFLY + "verticalspeed"; - public static final String MOVING_CREATIVEFLY_ACTIONS = MOVING_CREATIVEFLY + "actions"; + private static final String MOVING_CREATIVEFLY = MOVING + "creativefly."; + public static final String MOVING_CREATIVEFLY_CHECK = MOVING_CREATIVEFLY + "active"; + public static final String MOVING_CREATIVEFLY_HORIZONTALSPEED = MOVING_CREATIVEFLY + "horizontalspeed"; + public static final String MOVING_CREATIVEFLY_MAXHEIGHT = MOVING_CREATIVEFLY + "maxheight"; + public static final String MOVING_CREATIVEFLY_VERTICALSPEED = MOVING_CREATIVEFLY + "verticalspeed"; + public static final String MOVING_CREATIVEFLY_ACTIONS = MOVING_CREATIVEFLY + "actions"; - private static final String MOVING_MOREPACKETS = MOVING + "morepackets."; - public static final String MOVING_MOREPACKETS_CHECK = MOVING_MOREPACKETS + "active"; - public static final String MOVING_MOREPACKETS_ACTIONS = MOVING_MOREPACKETS + "actions"; + private static final String MOVING_MOREPACKETS = MOVING + "morepackets."; + public static final String MOVING_MOREPACKETS_CHECK = MOVING_MOREPACKETS + "active"; + public static final String MOVING_MOREPACKETS_ACTIONS = MOVING_MOREPACKETS + "actions"; - private static final String MOVING_MOREPACKETSVEHICLE = MOVING + "morepacketsvehicle."; - public static final String MOVING_MOREPACKETSVEHICLE_CHECK = MOVING_MOREPACKETSVEHICLE + "active"; - public static final String MOVING_MOREPACKETSVEHICLE_ACTIONS = MOVING_MOREPACKETSVEHICLE + "actions"; + private static final String MOVING_MOREPACKETSVEHICLE = MOVING + "morepacketsvehicle."; + public static final String MOVING_MOREPACKETSVEHICLE_CHECK = MOVING_MOREPACKETSVEHICLE + "active"; + public static final String MOVING_MOREPACKETSVEHICLE_ACTIONS = MOVING_MOREPACKETSVEHICLE + "actions"; - private static final String MOVING_NOFALL = MOVING + "nofall."; - public static final String MOVING_NOFALL_CHECK = MOVING_NOFALL + "active"; - public static final String MOVING_NOFALL_ACTIONS = MOVING_NOFALL + "actions"; + private static final String MOVING_NOFALL = MOVING + "nofall."; + public static final String MOVING_NOFALL_CHECK = MOVING_NOFALL + "active"; + public static final String MOVING_NOFALL_ACTIONS = MOVING_NOFALL + "actions"; - private static final String MOVING_SURVIVALFLY = MOVING + "survivalfly."; - public static final String MOVING_SURVIVALFLY_CHECK = MOVING_SURVIVALFLY + "active"; - public static final String MOVING_SURVIVALFLY_BLOCKINGSPEED = MOVING_SURVIVALFLY + "blockingspeed"; - public static final String MOVING_SURVIVALFLY_SNEAKINGSPEED = MOVING_SURVIVALFLY + "sneakingspeed"; - public static final String MOVING_SURVIVALFLY_SPRINTINGSPEED = MOVING_SURVIVALFLY + "sprintingspeed"; - public static final String MOVING_SURVIVALFLY_SWIMMINGSPEED = MOVING_SURVIVALFLY + "swimmingspeed"; - public static final String MOVING_SURVIVALFLY_WALKINGSPEED = MOVING_SURVIVALFLY + "walkingspeed"; - public static final String MOVING_SURVIVALFLY_ACTIONS = MOVING_SURVIVALFLY + "actions"; + private static final String MOVING_SURVIVALFLY = MOVING + "survivalfly."; + public static final String MOVING_SURVIVALFLY_CHECK = MOVING_SURVIVALFLY + "active"; + public static final String MOVING_SURVIVALFLY_BLOCKINGSPEED = MOVING_SURVIVALFLY + "blockingspeed"; + public static final String MOVING_SURVIVALFLY_SNEAKINGSPEED = MOVING_SURVIVALFLY + "sneakingspeed"; + public static final String MOVING_SURVIVALFLY_SPRINTINGSPEED = MOVING_SURVIVALFLY + "sprintingspeed"; + public static final String MOVING_SURVIVALFLY_SWIMMINGSPEED = MOVING_SURVIVALFLY + "swimmingspeed"; + public static final String MOVING_SURVIVALFLY_WALKINGSPEED = MOVING_SURVIVALFLY + "walkingspeed"; + public static final String MOVING_SURVIVALFLY_ACTIONS = MOVING_SURVIVALFLY + "actions"; /* * dP"8 d8 ,e, @@ -334,5 +338,5 @@ public abstract class ConfPaths { * , 88P * "8",P" */ - public static final String STRINGS = "strings"; + public static final String STRINGS = "strings"; } diff --git a/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java b/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java index 5f7746c4..78d85183 100644 --- a/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java +++ b/src/fr/neatmonster/nocheatplus/config/DefaultConfig.java @@ -48,9 +48,12 @@ public class DefaultConfig extends ConfigFile { * d888b Y8b Y8b 888 d,dP "88,e8' "YeeP" 888 888 "88 888 888 888 "YeeP" "88 88" "88 88" d,dP */ set(ConfPaths.MISCELLANEOUS_ALLOWCLIENTMODS, false); - set(ConfPaths.MISCELLANEOUS_NOMOVEDTOOQUICKLY, false); set(ConfPaths.MISCELLANEOUS_OPINCONSOLEONLY, false); set(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS, true); + set(ConfPaths.MISCELLANEOUS_REPORTTOMETRICS, true); + + set(ConfPaths.MISCELLANEOUS_NOMOVEDTOOQUICKLY_ENABLED, false); + set(ConfPaths.MISCELLANEOUS_NOMOVEDTOOQUICKLY_USEPROXY, false); /* * 888 88b, 888 888 888 88b, 888 diff --git a/src/fr/neatmonster/nocheatplus/metrics/MetricsData.java b/src/fr/neatmonster/nocheatplus/metrics/MetricsData.java index 8d54a363..b25adabc 100644 --- a/src/fr/neatmonster/nocheatplus/metrics/MetricsData.java +++ b/src/fr/neatmonster/nocheatplus/metrics/MetricsData.java @@ -5,6 +5,8 @@ import java.util.Map; import fr.neatmonster.nocheatplus.checks.CheckType; import fr.neatmonster.nocheatplus.checks.ViolationData; +import fr.neatmonster.nocheatplus.config.ConfPaths; +import fr.neatmonster.nocheatplus.config.ConfigManager; import fr.neatmonster.nocheatplus.metrics.Metrics.Plotter; /* @@ -51,8 +53,8 @@ public class MetricsData { } } - /** The violation levels. */ - private static final Map violationLevels = new HashMap(); + /** Is Metrics enabled? */ + private static boolean enabled; /** The checks failed. */ private static final Map checksFailed = new HashMap(); @@ -63,6 +65,9 @@ public class MetricsData { /** The server ticks. */ private static final Map serverTicks = new HashMap(); + /** The violation levels. */ + private static final Map violationLevels = new HashMap(); + /** * Adds the checked. * @@ -70,7 +75,7 @@ public class MetricsData { * the type */ public static void addChecked(final CheckType type) { - if (type.getParent() != null) + if (enabled && type.getParent() != null) eventsChecked.put(type, getChecked(type) + 1); } @@ -81,7 +86,8 @@ public class MetricsData { * the ticks */ public static void addTicks(final int ticks) { - serverTicks.put(ticks, serverTicks.get(ticks) + 1); + if (enabled) + serverTicks.put(ticks, serverTicks.get(ticks) + 1); } /** @@ -92,7 +98,7 @@ public class MetricsData { */ public static void addViolation(final ViolationData violationData) { final CheckType type = violationData.check.getType(); - if (type.getParent() != null) { + if (enabled && type.getParent() != null) { checksFailed.put(type, getFailed(type) + 1); violationLevels.put(type, getViolationLevel(type) + violationData.addedVL); } @@ -106,12 +112,6 @@ public class MetricsData { * @return the checked */ public static int getChecked(final CheckType type) { - if (type == CheckType.ALL) { - int eventsChecked = 0; - for (final double value : MetricsData.eventsChecked.values()) - eventsChecked += value; - return eventsChecked; - } if (!eventsChecked.containsKey(type)) resetChecked(type); return eventsChecked.get(type); @@ -125,12 +125,6 @@ public class MetricsData { * @return the failed */ public static int getFailed(final CheckType type) { - if (type == CheckType.ALL) { - int checkFails = 0; - for (final double value : checksFailed.values()) - checkFails += value; - return checkFails; - } if (!checksFailed.containsKey(type)) resetFailed(type); return checksFailed.get(type); @@ -157,17 +151,18 @@ public class MetricsData { * @return the violation level */ public static double getViolationLevel(final CheckType type) { - if (type == CheckType.ALL) { - double violationLevel = 0D; - for (final double value : violationLevels.values()) - violationLevel += value; - return violationLevel; - } if (!violationLevels.containsKey(type)) resetViolationLevel(type); return violationLevels.get(type); } + /** + * Initialize the class. + */ + public static void initialize() { + enabled = ConfigManager.getConfigFile().getBoolean(ConfPaths.MISCELLANEOUS_REPORTTOMETRICS); + } + /** * Reset checked. * diff --git a/src/fr/neatmonster/nocheatplus/packets/NCPPacket11PlayerPosition.java b/src/fr/neatmonster/nocheatplus/packets/NCPPacket11PlayerPosition.java deleted file mode 100644 index 3317e436..00000000 --- a/src/fr/neatmonster/nocheatplus/packets/NCPPacket11PlayerPosition.java +++ /dev/null @@ -1,49 +0,0 @@ -package fr.neatmonster.nocheatplus.packets; - -import net.minecraft.server.NetHandler; -import net.minecraft.server.NetServerHandler; -import net.minecraft.server.Packet11PlayerPosition; - -/* - * M"""""""`YM MM'""""'YMM MM"""""""`YM MM"""""""`YM dP dP d88 d88 - * M mmmm. M M' .mmm. `M MM mmmmm M MM mmmmm M 88 88 88 88 - * M MMMMM M M MMMMMooM M' .M M' .M .d8888b. .d8888b. 88 .dP .d8888b. d8888P 88 88 - * M MMMMM M M MMMMMMMM MM MMMMMMMM MM MMMMMMMM 88' `88 88' `"" 88888" 88ooood8 88 88 88 - * M MMMMM M M. `MMM' .M MM MMMMMMMM MM MMMMMMMM 88. .88 88. ... 88 `8b. 88. ... 88 88 88 - * M MMMMM M MM. .dM MM MMMMMMMM MM MMMMMMMM `88888P8 `88888P' dP `YP `88888P' dP d88P d88P - * MMMMMMMMMMM MMMMMMMMMMM MMMMMMMMMMMM MMMMMMMMMMMM - * - * MM"""""""`YM dP MM"""""""`YM oo dP oo - * MM mmmmm M 88 MM mmmmm M 88 - * M' .M 88 .d8888b. dP dP .d8888b. 88d888b. M' .M .d8888b. .d8888b. dP d8888P dP .d8888b. 88d888b. - * MM MMMMMMMM 88 88' `88 88 88 88ooood8 88' `88 MM MMMMMMMM 88' `88 Y8ooooo. 88 88 88 88' `88 88' `88 - * MM MMMMMMMM 88 88. .88 88. .88 88. ... 88 MM MMMMMMMM 88. .88 88 88 88 88 88. .88 88 88 - * MM MMMMMMMM dP `88888P8 `8888P88 `88888P' dP MM MMMMMMMM `88888P' `88888P' dP dP dP `88888P' dP dP - * MMMMMMMMMMMM .88 MMMMMMMMMMMM - * d8888P - */ -/** - * A custom PlayerPosition packet. - */ -public class NCPPacket11PlayerPosition extends Packet11PlayerPosition { - - /* (non-Javadoc) - * @see net.minecraft.server.Packet10Flying#handle(net.minecraft.server.NetHandler) - */ - @Override - public void handle(final NetHandler netHandler) { - if (netHandler instanceof NetServerHandler && hasPos) { - final NetServerHandler nsh = (NetServerHandler) netHandler; - final double deltaX = Math.max(Math.abs(x - nsh.player.locX), Math.abs(nsh.player.motX)); - final double deltaY = Math.max(Math.abs(y - nsh.player.locY), Math.abs(nsh.player.motY)); - final double deltaZ = Math.max(Math.abs(z - nsh.player.locZ), Math.abs(nsh.player.motZ)); - final double delta = deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ; - if (delta > 100D) { - nsh.player.locX = x; - nsh.player.locY = y; - nsh.player.locZ = z; - } - } - super.handle(netHandler); - } -} diff --git a/src/fr/neatmonster/nocheatplus/packets/NCPPacket13PlayerLookMove.java b/src/fr/neatmonster/nocheatplus/packets/NCPPacket13PlayerLookMove.java deleted file mode 100644 index a2f4a9cb..00000000 --- a/src/fr/neatmonster/nocheatplus/packets/NCPPacket13PlayerLookMove.java +++ /dev/null @@ -1,57 +0,0 @@ -package fr.neatmonster.nocheatplus.packets; - -import net.minecraft.server.NetHandler; -import net.minecraft.server.NetServerHandler; -import net.minecraft.server.Packet13PlayerLookMove; - -/* - * M"""""""`YM MM'""""'YMM MM"""""""`YM MM"""""""`YM dP dP d88 d8888b. - * M mmmm. M M' .mmm. `M MM mmmmm M MM mmmmm M 88 88 88 `88 - * M MMMMM M M MMMMMooM M' .M M' .M .d8888b. .d8888b. 88 .dP .d8888b. d8888P 88 aaad8' - * M MMMMM M M MMMMMMMM MM MMMMMMMM MM MMMMMMMM 88' `88 88' `"" 88888" 88ooood8 88 88 `88 - * M MMMMM M M. `MMM' .M MM MMMMMMMM MM MMMMMMMM 88. .88 88. ... 88 `8b. 88. ... 88 88 .88 - * M MMMMM M MM. .dM MM MMMMMMMM MM MMMMMMMM `88888P8 `88888P' dP `YP `88888P' dP d88P d88888P - * MMMMMMMMMMM MMMMMMMMMMM MMMMMMMMMMMM MMMMMMMMMMMM - * - * MM"""""""`YM dP M""MMMMMMMM dP - * MM mmmmm M 88 M MMMMMMMM 88 - * M' .M 88 .d8888b. dP dP .d8888b. 88d888b. M MMMMMMMM .d8888b. .d8888b. 88 .dP - * MM MMMMMMMM 88 88' `88 88 88 88ooood8 88' `88 M MMMMMMMM 88' `88 88' `88 88888" - * MM MMMMMMMM 88 88. .88 88. .88 88. ... 88 M MMMMMMMM 88. .88 88. .88 88 `8b. - * MM MMMMMMMM dP `88888P8 `8888P88 `88888P' dP M M `88888P' `88888P' dP `YP - * MMMMMMMMMMMM .88 MMMMMMMMMMM - * d8888P - * - * M"""""`'"""`YM - * M mm. mm. M - * M MMM MMM M .d8888b. dP .dP .d8888b. - * M MMM MMM M 88' `88 88 d8' 88ooood8 - * M MMM MMM M 88. .88 88 .88' 88. ... - * M MMM MMM M `88888P' 8888P' `88888P' - * MMMMMMMMMMMMMM - */ -/** - * A custom PlayerLookMove packet. - */ -public class NCPPacket13PlayerLookMove extends Packet13PlayerLookMove { - - /* (non-Javadoc) - * @see net.minecraft.server.Packet10Flying#handle(net.minecraft.server.NetHandler) - */ - @Override - public void handle(final NetHandler netHandler) { - if (netHandler instanceof NetServerHandler && hasPos) { - final NetServerHandler nsh = (NetServerHandler) netHandler; - final double deltaX = Math.max(Math.abs(x - nsh.player.motX), Math.abs(nsh.player.motX)); - final double deltaY = Math.max(Math.abs(y - nsh.player.motY), Math.abs(nsh.player.motY)); - final double deltaZ = Math.max(Math.abs(z - nsh.player.motZ), Math.abs(nsh.player.motZ)); - final double delta = deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ; - if (delta > 100D) { - nsh.player.locX = x; - nsh.player.locY = y; - nsh.player.locZ = z; - } - } - super.handle(netHandler); - } -} \ No newline at end of file diff --git a/src/fr/neatmonster/nocheatplus/packets/PacketsWorkaround.java b/src/fr/neatmonster/nocheatplus/packets/PacketsWorkaround.java deleted file mode 100644 index 4508b499..00000000 --- a/src/fr/neatmonster/nocheatplus/packets/PacketsWorkaround.java +++ /dev/null @@ -1,73 +0,0 @@ -package fr.neatmonster.nocheatplus.packets; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; - -import net.minecraft.server.Packet; - -/* - * MM"""""""`YM dP dP - * MM mmmmm M 88 88 - * M' .M .d8888b. .d8888b. 88 .dP .d8888b. d8888P .d8888b. - * MM MMMMMMMM 88' `88 88' `"" 88888" 88ooood8 88 Y8ooooo. - * MM MMMMMMMM 88. .88 88. ... 88 `8b. 88. ... 88 88 - * MM MMMMMMMM `88888P8 `88888P' dP `YP `88888P' dP `88888P' - * MMMMMMMMMMMM - * - * M""MMM""MMM""M dP dP - * M MMM MMM M 88 88 - * M MMP MMP M .d8888b. 88d888b. 88 .dP .d8888b. 88d888b. .d8888b. dP dP 88d888b. .d888b88 - * M MM' MM' .M 88' `88 88' `88 88888" 88' `88 88' `88 88' `88 88 88 88' `88 88' `88 - * M `' . '' .MM 88. .88 88 88 `8b. 88. .88 88 88. .88 88. .88 88 88 88. .88 - * M .d .dMMM `88888P' dP dP `YP `88888P8 dP `88888P' `88888P' dP dP `88888P8 - * MMMMMMMMMMMMMM - */ -/** - * The packets workaround. - */ -public class PacketsWorkaround { - - /** The old classes. */ - private static Map> oldClasses = new HashMap>(); - - /** - * Disable the packets workaround. - */ - public static void disable() { - for (final int packetId : oldClasses.keySet()) - replace(packetId, oldClasses.get(packetId)); - } - - /** - * Enable the packets workaround. - */ - public static void enable() { - oldClasses.put(11, replace(11, NCPPacket11PlayerPosition.class)); - oldClasses.put(13, replace(13, NCPPacket13PlayerLookMove.class)); - } - - /** - * Replace a packet class. - * - * @param packetId - * the packet id - * @param newClass - * the new class - * @return the class - */ - @SuppressWarnings({"rawtypes", "unchecked"}) - private static Class replace(final int packetId, final Class newClass) { - final Class oldClass = (Class) Packet.l.d(packetId); - Packet.l.a(packetId, newClass); - try { - final Field aField = Packet.class.getDeclaredField("a"); - aField.setAccessible(true); - final Map a = (Map) aField.get(null); - a.put(newClass, packetId); - } catch (final Exception e) { - e.printStackTrace(); - } - return oldClass; - } -} \ No newline at end of file diff --git a/src/fr/neatmonster/nocheatplus/players/Permissions.java b/src/fr/neatmonster/nocheatplus/players/Permissions.java index a146ec50..c3e50ca1 100644 --- a/src/fr/neatmonster/nocheatplus/players/Permissions.java +++ b/src/fr/neatmonster/nocheatplus/players/Permissions.java @@ -26,6 +26,7 @@ public class Permissions { public static final String ADMINISTRATION_INFO = ADMINISTRATION + ".info"; public static final String ADMINISTRATION_NOTIFY = ADMINISTRATION + ".notify"; + public static final String ADMINISTRATION_PLUGINS = ADMINISTRATION + ".plugins"; public static final String ADMINISTRATION_RELOAD = ADMINISTRATION + ".reload"; private static final String CHECKS = NOCHEATPLUS + ".checks"; @@ -129,7 +130,6 @@ public class Permissions { public static final String MOVING_MOREPACKETS = MOVING + ".morepackets"; public static final String MOVING_MOREPACKETSVEHICLE = MOVING + ".morepacketsvehicle"; public static final String MOVING_NOFALL = MOVING + ".nofall"; - public static final String MOVING_OVERRIDEBUKKIT = MOVING + ".overridebukkit"; public static final String MOVING_SURVIVALFLY = MOVING + ".survivalfly"; public static final String MOVING_SURVIVALFLY_BLOCKING = MOVING_SURVIVALFLY + ".blocking"; public static final String MOVING_SURVIVALFLY_SNEAKING = MOVING_SURVIVALFLY + ".sneaking";