diff --git a/pom.xml b/pom.xml
index 5519edf..5044c50 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,14 +11,14 @@
UTF-8
-
- spigot-repo
- http://maven.elmakers.com/repository/
-
dmulloy2-repo
http://repo.dmulloy2.net/content/groups/public/
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
${basedir}/src/main/java
@@ -82,12 +82,6 @@
-
- org.bukkit
- craftbukkit
- 1.9.2-R0.1-SNAPSHOT
- provided
-
com.comphenix.protocol
ProtocolLib-API
@@ -100,6 +94,12 @@
jar
test
+
+ org.spigotmc
+ spigot-api
+ 1.10.2-R0.1-SNAPSHOT
+ provided
+
diff --git a/src/main/java/net/gravitydevelopment/anticheat/check/Backend.java b/src/main/java/net/gravitydevelopment/anticheat/check/Backend.java
index 78ac6fa..b92ba85 100644
--- a/src/main/java/net/gravitydevelopment/anticheat/check/Backend.java
+++ b/src/main/java/net/gravitydevelopment/anticheat/check/Backend.java
@@ -71,7 +71,6 @@ public class Backend {
private Map projectilesShot = new HashMap();
private Map velocitized = new HashMap();
private Map velocitytrack = new HashMap();
- private Map animated = new HashMap();
private Map startEat = new HashMap();
private Map lastHeal = new HashMap();
private Map projectileTime = new HashMap();
@@ -155,7 +154,6 @@ public class Backend {
projectilesShot.remove(pN);
velocitized.remove(pN);
velocitytrack.remove(pN);
- animated.remove(pN);
startEat.remove(pN);
lastHeal.remove(pN);
projectileTime.remove(pN);
@@ -703,14 +701,6 @@ public class Backend {
}
}
- public CheckResult checkAnimation(Player player, Entity e) {
- if (!justAnimated(player)) {
- return new CheckResult(CheckResult.Result.FAILED, player.getName() + " didn't animate before damaging a " + e.getType());
- } else {
- return PASS;
- }
- }
-
public CheckResult checkFastHeal(Player player) {
if (lastHeal.containsKey(player.getName())) // Otherwise it was modified by a plugin, don't worry about it.
{
@@ -735,13 +725,6 @@ public class Backend {
return PASS;
}
- public void logAnimation(final Player player) {
- animated.put(player.getName(), System.currentTimeMillis());
- increment(player, blockPunches, magic.BLOCK_PUNCH_MIN());
- itemInHand.put(player.getName(), player.getItemInHand().getType());
- interactionCount.put(player.getName(), 0);
- }
-
public void logInstantBreak(final Player player) {
instantBreakExempt.put(player.getName(), System.currentTimeMillis());
}
@@ -765,7 +748,6 @@ public class Backend {
public void logBlockBreak(final Player player) {
brokenBlock.put(player.getName(), System.currentTimeMillis());
- resetAnimation(player);
}
public boolean justBroke(Player player) {
@@ -807,29 +789,6 @@ public class Backend {
public boolean justPlaced(Player player) {
return isDoing(player, placedBlock, magic.BLOCK_PLACE_MIN());
}
-
- public void resetAnimation(final Player player) {
- animated.remove(player.getName());
- blockPunches.put(player.getName(), 0);
- }
-
- private boolean justAnimated(Player player) {
- String name = player.getName();
- if (animated.containsKey(name)) {
- long time = System.currentTimeMillis() - animated.get(name);
- int count = interactionCount.get(player.getName()) + 1;
- interactionCount.put(player.getName(), count);
-
- if (count > magic.ANIMATION_INTERACT_MAX()) {
- animated.remove(player.getName());
- return false;
- }
- return time < magic.ANIMATION_MIN();
- } else {
- return false;
- }
- }
-
public void logDamage(final Player player, int type) {
long time;
switch (type) {
diff --git a/src/main/java/net/gravitydevelopment/anticheat/check/combat/KillAuraCheck.java b/src/main/java/net/gravitydevelopment/anticheat/check/combat/KillAuraCheck.java
index 16476b9..5fdfd5a 100644
--- a/src/main/java/net/gravitydevelopment/anticheat/check/combat/KillAuraCheck.java
+++ b/src/main/java/net/gravitydevelopment/anticheat/check/combat/KillAuraCheck.java
@@ -1,83 +1,28 @@
package net.gravitydevelopment.anticheat.check.combat;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.player.PlayerMoveEvent;
-import com.comphenix.protocol.PacketType;
-import com.comphenix.protocol.events.ListenerPriority;
-import com.comphenix.protocol.events.PacketAdapter;
-import com.comphenix.protocol.events.PacketEvent;
-
-import net.gravitydevelopment.anticheat.AntiCheat;
-import net.gravitydevelopment.anticheat.check.CheckResult;
-import net.gravitydevelopment.anticheat.check.CheckType;
-import net.gravitydevelopment.anticheat.event.EventListener;
-import net.gravitydevelopment.anticheat.util.CheckerNPCS;
-import net.gravitydevelopment.anticheat.util.VersionUtil;
-
/**
* @author Rammelkast
*/
public class KillAuraCheck {
-
- private static final Map CHECKER_NPCS = new HashMap();
- private static final Map VL_COUNT = new HashMap();
public static void cleanPlayer(Player p) {
- if (CHECKER_NPCS.containsKey(p.getUniqueId()))
- CHECKER_NPCS.get(p.getUniqueId()).clean(p);
- CHECKER_NPCS.remove(p.getUniqueId());
- VL_COUNT.remove(p.getUniqueId());
+
}
public static void listenPackets() {
- AntiCheat.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheat.getPlugin(), ListenerPriority.NORMAL, new PacketType[] {PacketType.Play.Client.USE_ENTITY}) {
- @Override
- public void onPacketReceiving(PacketEvent e) {
- Player p = e.getPlayer();
- if (!CHECKER_NPCS.containsKey(p.getUniqueId()) || AntiCheat.getManager().getCheckManager().isOpExempt(p) || AntiCheat.getManager().getCheckManager().isExempt(p, CheckType.KILLAURA))
- return;
- int entityId = ((Integer)e.getPacket().getIntegers().read(0));
- boolean isBot = CHECKER_NPCS.get(p.getUniqueId()).onHit(entityId);
- if (isBot) {
- if (!VL_COUNT.containsKey(p.getUniqueId()))
- VL_COUNT.put(p.getUniqueId(), 1);
- else {
- VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
- if (VL_COUNT.get(p.getUniqueId()) >= AntiCheat.getManager().getBackend().getMagic().KILLAURA_BOTHITS()) {
- EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed Killaura, hit the bot " + VL_COUNT.get(p.getUniqueId()) + " times (max=" + AntiCheat.getManager().getBackend().getMagic().KILLAURA_BOTHITS() + ")").getMessage(), p, CheckType.KILLAURA);
- VL_COUNT.remove(p.getUniqueId());
- }
- }
- }
- }
- });
+
}
public static void doDamageEvent(EntityDamageByEntityEvent e, Player p) {
- if (AntiCheat.getManager().getCheckManager().isOpExempt(p) || AntiCheat.getManager().getCheckManager().isExempt(p, CheckType.KILLAURA))
- return;
- if (VersionUtil.getVersion().equals("v1_9_R1")) { // TODO 1.9 R2 support
- if (!CHECKER_NPCS.containsKey(p.getUniqueId())) { // Enable killaura check after player damaged other player, this is more efficient
- CHECKER_NPCS.put(p.getUniqueId(), new CheckerNPCS(p));
- }
- }
+
}
public static void doMove(PlayerMoveEvent e) {
- if (CHECKER_NPCS.containsKey(e.getPlayer().getUniqueId())) {
- if (AntiCheat.getManager().getCheckManager().isOpExempt(e.getPlayer()) || AntiCheat.getManager().getCheckManager().isExempt(e.getPlayer(), CheckType.KILLAURA)) {
- cleanPlayer(e.getPlayer());
- return;
- }
- CHECKER_NPCS.get(e.getPlayer().getUniqueId()).doMove(e);
- }
+
}
}
diff --git a/src/main/java/net/gravitydevelopment/anticheat/event/EntityListener.java b/src/main/java/net/gravitydevelopment/anticheat/event/EntityListener.java
index 87ed2ba..4f2b061 100644
--- a/src/main/java/net/gravitydevelopment/anticheat/event/EntityListener.java
+++ b/src/main/java/net/gravitydevelopment/anticheat/event/EntityListener.java
@@ -109,9 +109,6 @@ public class EntityListener extends EventListener {
if (event.getEntity() instanceof Player) {
Player player = (Player) event.getEntity();
VelocityCheck.runCheck(e, player);
- if (Utilities.hasArmorEnchantment(player, Enchantment.THORNS)) {
- getBackend().logAnimation(player);
- }
if (e.getDamager() instanceof Player) {
Player p = (Player) e.getDamager();
getBackend().logDamage(p, 1);
@@ -153,14 +150,6 @@ public class EntityListener extends EventListener {
noHack = false;
}
}
- if (getCheckManager().willCheck(player, CheckType.NO_SWING)) {
- CheckResult result = getBackend().checkAnimation(player, event.getEntity());
- if (result.failed()) {
- event.setCancelled(!silentMode());
- log(result.getMessage(), player, CheckType.NO_SWING);
- noHack = false;
- }
- }
if (getCheckManager().willCheck(player, CheckType.FORCEFIELD)) {
CheckResult result = getBackend().checkSight(player, e.getEntity());
if (result.failed()) {
diff --git a/src/main/java/net/gravitydevelopment/anticheat/event/PlayerListener.java b/src/main/java/net/gravitydevelopment/anticheat/event/PlayerListener.java
index 6664610..ab491e6 100644
--- a/src/main/java/net/gravitydevelopment/anticheat/event/PlayerListener.java
+++ b/src/main/java/net/gravitydevelopment/anticheat/event/PlayerListener.java
@@ -273,8 +273,6 @@ public class PlayerListener extends EventListener {
@EventHandler
public void onPlayerAnimation(PlayerAnimationEvent event) {
- getBackend().logAnimation(event.getPlayer());
-
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
}
diff --git a/src/main/java/net/gravitydevelopment/anticheat/util/CheckerNPCS.java b/src/main/java/net/gravitydevelopment/anticheat/util/CheckerNPCS.java
deleted file mode 100644
index 4c02c64..0000000
--- a/src/main/java/net/gravitydevelopment/anticheat/util/CheckerNPCS.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package net.gravitydevelopment.anticheat.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.bukkit.Location;
-import org.bukkit.entity.Player;
-import org.bukkit.event.player.PlayerMoveEvent;
-import org.bukkit.util.Vector;
-
-public class CheckerNPCS {
-
- private List NPCS = new ArrayList();
-
- public CheckerNPCS(Player p) {
- NPC npcOne = new NPC(NameUtil.getRandomName(), p.getWorld(), p);
- NPCS.add(npcOne);
- }
-
- public void doMove(PlayerMoveEvent e) {
- NPC one = NPCS.get(0);
- Location eyeLocation = e.getPlayer().getEyeLocation();
- Vector vec = e.getFrom().getDirection();
- Vector newVec = new Vector(vec.getX() * -2, vec.getY() * -2, vec.getZ() * -2);
- Location backLocation = eyeLocation.add(newVec);
- if (e.getPlayer().getLocation().getPitch() <= -45) {// TODO better fix for this
- Vector direction = e.getFrom().getDirection();
- Vector addVector = direction.setX(direction.getX() * -2).setY(direction.getY() * -2).setZ(direction.getZ() * -2);
- backLocation.add(addVector);
- }
- one.move(backLocation, e.getPlayer());
- }
-
- public boolean onHit(int entityId) {
- for (NPC npc : NPCS)
- if (npc.getEntityId() == entityId)
- return true;
- return false;
- }
-
- public void clean(Player p) {
- if (!p.isOnline())
- return;
- for (NPC npc : NPCS)
- npc.destroy(p);
- NPCS.clear();
- }
-
-}
diff --git a/src/main/java/net/gravitydevelopment/anticheat/util/NPC.java b/src/main/java/net/gravitydevelopment/anticheat/util/NPC.java
deleted file mode 100644
index 83b83c1..0000000
--- a/src/main/java/net/gravitydevelopment/anticheat/util/NPC.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package net.gravitydevelopment.anticheat.util;
-
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.World;
-import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
-import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
-import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
-import org.bukkit.entity.Player;
-import org.bukkit.util.Vector;
-
-import com.mojang.authlib.GameProfile;
-
-import net.minecraft.server.v1_9_R1.EntityPlayer;
-import net.minecraft.server.v1_9_R1.PacketPlayOutEntityDestroy;
-import net.minecraft.server.v1_9_R1.PacketPlayOutEntityTeleport;
-import net.minecraft.server.v1_9_R1.PacketPlayOutNamedEntitySpawn;
-import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerInfo;
-import net.minecraft.server.v1_9_R1.PlayerInteractManager;
-
-public class NPC {
-
- private final EntityPlayer npc;
-
- public NPC(String name, World w, Player owner) {
- this.npc = new EntityPlayer(((CraftServer) Bukkit.getServer()).getServer(), ((CraftWorld) w).getHandle(), new GameProfile(UUID.randomUUID(), name), new PlayerInteractManager(((CraftWorld) w).getHandle()));
- ((CraftPlayer)owner).getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{this.npc}));
- this.npc.setInvisible(true);
- Location eyeLocation = owner.getEyeLocation();
- Vector vec = owner.getLocation().getDirection();
- Vector newVec = new Vector(vec.getX() * -2, vec.getY() * -2, vec.getZ() * -2);
- Location backLocation = eyeLocation.add(newVec);
- if (owner.getLocation().getPitch() < -50 && owner.getLocation().getPitch() > -75)
- this.npc.setLocation(backLocation.getX(), backLocation.getY() + 1, backLocation.getZ(), 0, 0);
- else if (owner.getLocation().getPitch() >= -50)
- this.npc.setLocation(backLocation.getX(), backLocation.getY() - 0.25, backLocation.getZ(), 0, 0);
- else
- this.npc.setLocation(backLocation.getX(), backLocation.getY() + 1.75, backLocation.getZ(), 0, 0);
- ((CraftPlayer)owner).getHandle().playerConnection.sendPacket(new PacketPlayOutNamedEntitySpawn(this.npc));
- }
-
- public int getEntityId() {
- return npc.getId();
- }
-
- public void move(Location loc, Player owner) {
- this.npc.setLocation(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
- ((CraftPlayer)owner).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(this.npc));
- }
-
- public void destroy(Player p) {
- ((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[] { this.npc }));
- ((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[] { this.npc.getId() }));
- }
-
-}