mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Made KillAura/Botcheck more effective; tested with Wolfram 1.10
This commit is contained in:
1 parent
7a17837d28
commit
f26e63b45f
3 files changed
+22
-17
No files matched your search
@@ -30,14 +30,16 @@ public class KillAuraCheck {
|
||||
private static final Map<UUID, Integer> VL_COUNT = new HashMap<UUID, Integer>();
|
||||
|
||||
public static void cleanPlayer(Player p) {
|
||||
if (!VersionUtil.getVersion().equals("v1_10_R1"))
|
||||
if (!VersionUtil.getVersion().equals("v1_10_R1")) {
|
||||
return;
|
||||
}
|
||||
NPC_LIST.remove(p.getUniqueId());
|
||||
}
|
||||
|
||||
public static void listenPackets() {
|
||||
if (!VersionUtil.getVersion().equals("v1_10_R1"))
|
||||
if (!VersionUtil.getVersion().equals("v1_10_R1")) {
|
||||
return;
|
||||
}
|
||||
AntiCheat.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheat.getPlugin(), ListenerPriority.NORMAL, new PacketType[] {PacketType.Play.Client.USE_ENTITY}) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent e) {
|
||||
@@ -45,16 +47,18 @@ public class KillAuraCheck {
|
||||
if (!NPC_LIST.containsKey(p.getUniqueId()))
|
||||
return;
|
||||
int id = e.getPacket().getIntegers().read(0);
|
||||
if (NPC_LIST.containsKey(p.getUniqueId()))
|
||||
if (NPC_LIST.get(p.getUniqueId()).getID() != id)
|
||||
if (NPC_LIST.containsKey(p.getUniqueId())) {
|
||||
if (NPC_LIST.get(p.getUniqueId()).getID() != id) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!VL_COUNT.containsKey(p.getUniqueId())) {
|
||||
VL_COUNT.put(p.getUniqueId(), 0);
|
||||
VL_COUNT.put(p.getUniqueId(), 1);
|
||||
NPC_LIST.get(p.getUniqueId()).damage();
|
||||
}else {
|
||||
VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
|
||||
if (VL_COUNT.get(p.getUniqueId()) >= 5) {
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed KillAura (botcheck), hit the bot " + VL_COUNT.get(p.getUniqueId()) + "times (max=5)").getMessage(), p, CheckType.BLINK);
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed KillAura (botcheck), hit the bot " + VL_COUNT.get(p.getUniqueId()) + " times (max=5)").getMessage(), p, CheckType.BLINK);
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
}
|
||||
}
|
||||
@@ -63,8 +67,9 @@ public class KillAuraCheck {
|
||||
}
|
||||
|
||||
public static void doDamageEvent(EntityDamageByEntityEvent e, Player p) {
|
||||
if (!VersionUtil.getVersion().equals("v1_10_R1"))
|
||||
if (!VersionUtil.getVersion().equals("v1_10_R1")) {
|
||||
return;
|
||||
}
|
||||
if (NPC_LIST.containsKey(p.getUniqueId()))
|
||||
NPC_LIST.get(p.getUniqueId()).damage(e, p);
|
||||
else {
|
||||
@@ -75,8 +80,9 @@ public class KillAuraCheck {
|
||||
}
|
||||
|
||||
public static void doMove(PlayerMoveEvent e) {
|
||||
if (!VersionUtil.getVersion().equals("v1_10_R1"))
|
||||
if (!VersionUtil.getVersion().equals("v1_10_R1")) {
|
||||
return;
|
||||
}
|
||||
if (NPC_LIST.containsKey(e.getPlayer().getUniqueId()))
|
||||
NPC_LIST.get(e.getPlayer().getUniqueId()).move(e);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package net.gravitydevelopment.anticheat.check.movement;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
@@ -92,7 +92,7 @@ public class NPC_1_10 {
|
||||
NPC_1_10.this.npc.setInvisible(true);
|
||||
((CraftPlayer) NPC_1_10.this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
}
|
||||
}.runTaskLater(AntiCheat.getPlugin(), 3);
|
||||
}.runTaskLater(AntiCheat.getPlugin(), 4);
|
||||
}
|
||||
}else {
|
||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
||||
@@ -108,9 +108,9 @@ public class NPC_1_10 {
|
||||
} else if (e.getTo().getPitch() >= 22) {
|
||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
||||
Vector vec = e.getPlayer().getLocation().getDirection();
|
||||
vec.setX(-2.5 * vec.getX());
|
||||
vec.setY(e.getPlayer().getLocation().getY() + 1.5);
|
||||
vec.setZ(-2.5 * vec.getZ());
|
||||
vec.setX(-3 * vec.getX());
|
||||
vec.setY(e.getPlayer().getLocation().getY() - 0.4);
|
||||
vec.setZ(-3 * vec.getZ());
|
||||
Location back = eyelocation.add(vec);
|
||||
this.location = back; // TODO
|
||||
this.npc.teleportTo(back, false);
|
||||
@@ -128,6 +128,7 @@ public class NPC_1_10 {
|
||||
vec.setZ(-1.95 * vec.getZ());
|
||||
Location back = eyelocation.add(vec);
|
||||
this.location = back; // TODO
|
||||
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
|
||||
this.npc.teleportTo(back, false);
|
||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||
.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
||||
@@ -140,7 +141,7 @@ public class NPC_1_10 {
|
||||
NPC_1_10.this.npc.setInvisible(true);
|
||||
((CraftPlayer) NPC_1_10.this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
}
|
||||
}.runTaskLater(AntiCheat.getPlugin(), 5);
|
||||
}.runTaskLater(AntiCheat.getPlugin(), 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,7 +162,7 @@ public class NPC_1_10 {
|
||||
NPC_1_10.this.npc.setInvisible(true);
|
||||
((CraftPlayer) NPC_1_10.this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
}
|
||||
}.runTaskLater(AntiCheat.getPlugin(), 5 + new Random().nextInt(5));
|
||||
}.runTaskLater(AntiCheat.getPlugin(), 6 + new Random().nextInt(7));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +176,7 @@ public class NPC_1_10 {
|
||||
NPC_1_10.this.npc.setInvisible(true);
|
||||
((CraftPlayer) NPC_1_10.this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
}
|
||||
}.runTaskLater(AntiCheat.getPlugin(), 5 + new Random().nextInt(8));
|
||||
}.runTaskLater(AntiCheat.getPlugin(), 6 + new Random().nextInt(8));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user