1704 lines
94 KiB
Diff
1704 lines
94 KiB
Diff
From 3ea366ff12af85ada6123e625f3b60841057e05c Mon Sep 17 00:00:00 2001
|
|
From: Alfie Cleveland <alfeh@me.com>
|
|
Date: Mon, 26 Nov 2018 19:49:17 -0600
|
|
Subject: [PATCH] AC changes
|
|
|
|
|
|
diff --git a/src/main/java/net/hylist/HylistSpigot.java b/src/main/java/net/hylist/HylistSpigot.java
|
|
new file mode 100644
|
|
index 00000000..42516a1e
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/hylist/HylistSpigot.java
|
|
@@ -0,0 +1,37 @@
|
|
+package net.hylist;
|
|
+
|
|
+import net.hylist.handler.MovementHandler;
|
|
+import net.hylist.handler.PacketHandler;
|
|
+import org.bukkit.Bukkit;
|
|
+
|
|
+import java.util.HashSet;
|
|
+import java.util.Set;
|
|
+
|
|
+public enum HylistSpigot {
|
|
+
|
|
+ INSTANCE;
|
|
+
|
|
+ private Set<PacketHandler> packetHandlers = new HashSet<>();
|
|
+ private Set<MovementHandler> movementHandlers = new HashSet<>();
|
|
+
|
|
+ public Set<PacketHandler> getPacketHandlers() {
|
|
+ return this.packetHandlers;
|
|
+ }
|
|
+
|
|
+ public Set<MovementHandler> getMovementHandlers() {
|
|
+ return this.movementHandlers;
|
|
+ }
|
|
+
|
|
+ public void addPacketHandler(PacketHandler handler) {
|
|
+ Bukkit.getLogger().info("Adding packet handler: " + handler.getClass().getPackage().getName() + "." + handler.getClass().getName());
|
|
+ this.packetHandlers.add(handler);
|
|
+ }
|
|
+
|
|
+ public void addMovementHandler(MovementHandler handler) {
|
|
+
|
|
+ Bukkit.getLogger().info("Adding movement handler: " + handler.getClass().getPackage().getName() + "." + handler.getClass().getName());
|
|
+ this.movementHandlers.add(handler);
|
|
+ }
|
|
+
|
|
+
|
|
+}
|
|
diff --git a/src/main/java/net/hylist/handler/MovementHandler.java b/src/main/java/net/hylist/handler/MovementHandler.java
|
|
new file mode 100644
|
|
index 00000000..a1dede6b
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/hylist/handler/MovementHandler.java
|
|
@@ -0,0 +1,13 @@
|
|
+package net.hylist.handler;
|
|
+
|
|
+import net.minecraft.server.PacketPlayInFlying;
|
|
+import org.bukkit.Location;
|
|
+import org.bukkit.entity.Player;
|
|
+
|
|
+public interface MovementHandler {
|
|
+
|
|
+ void handleUpdateLocation(Player player, Location to, Location from, PacketPlayInFlying packet);
|
|
+
|
|
+ void handleUpdateRotation(Player player, Location to, Location from, PacketPlayInFlying packet);
|
|
+
|
|
+}
|
|
diff --git a/src/main/java/net/hylist/handler/PacketHandler.java b/src/main/java/net/hylist/handler/PacketHandler.java
|
|
new file mode 100644
|
|
index 00000000..82f10b71
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/hylist/handler/PacketHandler.java
|
|
@@ -0,0 +1,11 @@
|
|
+package net.hylist.handler;
|
|
+
|
|
+import net.minecraft.server.Packet;
|
|
+import net.minecraft.server.PlayerConnection;
|
|
+
|
|
+public interface PacketHandler {
|
|
+
|
|
+ void handleReceivedPacket(PlayerConnection connection, Packet packet);
|
|
+
|
|
+ void handleSentPacket(PlayerConnection connection, Packet packet);
|
|
+}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
index 5101d3a1..200adcf1 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
@@ -1002,9 +1002,6 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
|
|
|
|
// Guardian start
|
|
attackedPlayer.playerConnection.lastMotionTick = MinecraftServer.currentTick;
|
|
- attackedPlayer.playerConnection.lastHitMotionX = entity.motX;
|
|
- attackedPlayer.playerConnection.lastHitMotionY = entity.motY;
|
|
- attackedPlayer.playerConnection.lastHitMotionZ = entity.motZ;
|
|
// Guardian end
|
|
|
|
attackedPlayer.velocityChanged = false;
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index 4317cd3b..f5f4a205 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -720,14 +720,6 @@ public abstract class EntityLiving extends Entity {
|
|
this.aF = 1.5F;
|
|
boolean flag = true;
|
|
|
|
- // Guardian start
|
|
- if ((this instanceof EntityPlayer)) {
|
|
- ((EntityPlayer)this).playerConnection.speedPackets = 0;
|
|
- ((EntityPlayer)this).playerConnection.notHitPackets = 0;
|
|
- ((EntityPlayer)this).playerConnection.lastHit = System.currentTimeMillis();
|
|
- }
|
|
- // Guardian end
|
|
-
|
|
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
|
|
if (f <= this.lastDamage) {
|
|
return false;
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
index 2397a59e..48c086f9 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
@@ -561,12 +561,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
}
|
|
}
|
|
|
|
- // Guardian start
|
|
- if (damagesource.isExplosion()) {
|
|
- this.playerConnection.lastHitByExplosion = System.currentTimeMillis();
|
|
- }
|
|
- // Guardian end
|
|
-
|
|
return super.damageEntity(damagesource, f);
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
index ef77a210..d9895d18 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
@@ -366,16 +366,6 @@ public class EntityTrackerEntry {
|
|
}
|
|
// CraftBukkit end
|
|
|
|
- // Guardian start
|
|
- if (this.tracker instanceof EntityPlayer) {
|
|
- for (AttributeInstance attr : (Collection<AttributeInstance>) set) {
|
|
- if (attr.getAttribute() == GenericAttributes.d) {
|
|
- ((EntityPlayer)this.tracker).playerConnection.updateMovementSpeed();
|
|
- }
|
|
- }
|
|
- }
|
|
- // Guardian end
|
|
-
|
|
// MineHQ start
|
|
// this.broadcastIncludingSelf(new PacketPlayOutUpdateAttributes(this.tracker.getId(), set)); // CraftBukkit
|
|
if (this.tracker.passenger instanceof EntityPlayer) {
|
|
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
index eca2f330..00f19497 100644
|
|
--- a/src/main/java/net/minecraft/server/NetworkManager.java
|
|
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
@@ -6,6 +6,8 @@ import java.util.List;
|
|
import java.util.Queue;
|
|
import javax.crypto.SecretKey;
|
|
|
|
+import net.hylist.HylistSpigot;
|
|
+import net.hylist.handler.PacketHandler;
|
|
import net.minecraft.util.com.google.common.collect.Queues;
|
|
import net.minecraft.util.com.google.common.util.concurrent.ThreadFactoryBuilder;
|
|
import net.minecraft.util.com.mojang.authlib.properties.Property;
|
|
@@ -166,219 +168,20 @@ public class NetworkManager extends SimpleChannelInboundHandler {
|
|
if (this.m.isOpen() && !this.lockDownIncomingTraffic) { // Poweruser
|
|
if (packet.a()) {
|
|
packet.handle(this.o);
|
|
- // Guardian start
|
|
if (packet instanceof PacketPlayInKeepAlive) {
|
|
this.k.add(packet);
|
|
}
|
|
- // Guardian end
|
|
- } else {
|
|
- // Guardian start
|
|
- if ((this.o instanceof PlayerConnection)) {
|
|
- PlayerConnection connection = (PlayerConnection)this.o;
|
|
-
|
|
- if (((packet instanceof PacketPlayInChat)) || ((packet instanceof PacketPlayInCustomPayload))) {
|
|
- this.k.add(packet);
|
|
- return;
|
|
- }
|
|
-
|
|
- if ((packet instanceof PacketPlayInFlying)) {
|
|
- connection.movesReceived += 1L;
|
|
- connection.killAuraXSwing = false;
|
|
- if (packet.getClass() != PacketPlayInFlying.class) {
|
|
- this.numOfFlyingPacketsInARow = 0;
|
|
- } else if (++this.numOfFlyingPacketsInARow == 21 && Bukkit.shouldGuardianAct()) {
|
|
- String message = connection.getPlayer().getName() + " is using Regen (Module B)";
|
|
- runSync(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.REGENERATION, "B", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- );
|
|
- }
|
|
- }
|
|
-
|
|
- if (!connection.player.abilities.canInstantlyBuild) {
|
|
- if ((connection.lastAttackPlayerTime == 0L) || (this.currentTime - connection.lastAttackPlayerTime > 5000L) || (!Bukkit.shouldGuardianAct())) {
|
|
- connection.autoclickerAStage = (connection.autoclickerAThreshold = 0);
|
|
- connection.autoClickerBStage = (connection.autoClickerBThreshold = connection.killAuraTypePOther = 0);
|
|
- connection.killAuraNStage = (connection.killAuraQThreshold = 0);
|
|
- } else {
|
|
- // Autoclicker Module A
|
|
- if (connection.autoclickerAStage == 0) {
|
|
- if ((packet instanceof PacketPlayInArmAnimation)) {
|
|
- connection.autoclickerAStage = 1;
|
|
- }
|
|
- } else if (connection.autoclickerAStage == 1) {
|
|
- if (((packet instanceof PacketPlayInBlockDig)) && (((PacketPlayInBlockDig)packet).g() == 0)) {
|
|
- connection.autoclickerAStage = 2;
|
|
- } else {
|
|
- connection.autoclickerAStage = 0;
|
|
- }
|
|
- } else if (connection.autoclickerAStage == 2) {
|
|
- if (((packet instanceof PacketPlayInBlockDig)) && (((PacketPlayInBlockDig)packet).g() == 1)) {
|
|
- if (++connection.autoclickerAThreshold == 5) {
|
|
- connection.autoclickerAThreshold = 0;
|
|
-
|
|
- String message = connection.getPlayer().getName() + " is using Autoclicker (Module A)";
|
|
- runSync(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.AUTO_CLICKER, "A", GuardianEvent.DisplayLevel.HIGHEST, message)
|
|
- );
|
|
- }
|
|
- } else {
|
|
- connection.autoclickerAThreshold = 0;
|
|
- }
|
|
- connection.autoclickerAStage = 0;
|
|
- }
|
|
|
|
- // Autoclicker Module B
|
|
- if (connection.autoClickerBStage == 0) {
|
|
- if ((packet instanceof PacketPlayInArmAnimation)) {
|
|
- connection.autoClickerBStage = 1;
|
|
- }
|
|
- } else if (connection.autoClickerBStage == 1) {
|
|
- if (((packet instanceof PacketPlayInBlockDig)) && (((PacketPlayInBlockDig)packet).g() == 0)) {
|
|
- connection.autoClickerBStage = 2;
|
|
- } else {
|
|
- connection.autoClickerBStage = 0;
|
|
- }
|
|
- } else if (connection.autoClickerBStage == 2) {
|
|
- if (((packet instanceof PacketPlayInBlockDig)) && (((PacketPlayInBlockDig)packet).g() == 1)) {
|
|
- if (++connection.autoClickerBThreshold == 5) {
|
|
- if (connection.autoClickerBStage > 0) {
|
|
- String message = connection.getPlayer().getName() + " is using Autoclicker (Module B) [" + connection.killAuraTypePOther + "]";
|
|
- runSync(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.AUTO_CLICKER, "B", GuardianEvent.DisplayLevel.HIGHEST, message)
|
|
- .addData("other", connection.killAuraTypePOther)
|
|
- );
|
|
- }
|
|
- connection.autoClickerBThreshold = (connection.killAuraTypePOther = 0);
|
|
- }
|
|
- connection.autoClickerBStage = 0;
|
|
- } else if ((packet instanceof PacketPlayInArmAnimation)) {
|
|
- connection.autoClickerBStage = 3;
|
|
- } else {
|
|
- connection.autoClickerBStage = (connection.autoClickerBThreshold = connection.killAuraTypePOther = 0);
|
|
- }
|
|
- } else if (connection.autoClickerBStage == 3) {
|
|
- if ((packet instanceof PacketPlayInFlying)) {
|
|
- connection.autoClickerBStage = 4;
|
|
- } else {
|
|
- connection.autoClickerBStage = (connection.autoClickerBThreshold = connection.killAuraTypePOther = 0);
|
|
- }
|
|
- } else if (connection.autoClickerBStage == 4) {
|
|
- if (((packet instanceof PacketPlayInBlockDig)) && (((PacketPlayInBlockDig)packet).g() == 1)) {
|
|
- connection.killAuraTypePOther += 1;
|
|
- connection.autoClickerBStage = 0;
|
|
- } else {
|
|
- connection.autoClickerBStage = (connection.autoClickerBThreshold = connection.killAuraTypePOther = 0);
|
|
- }
|
|
- }
|
|
-
|
|
- // KillAura Module N
|
|
- if ((connection.killAuraNStage != 1) && ((packet instanceof PacketPlayInBlockDig)) && (((PacketPlayInBlockDig)packet).g() == 0)) {
|
|
- connection.killAuraQThreshold = 0;
|
|
- }
|
|
-
|
|
- if (connection.killAuraNStage == 0) {
|
|
- if ((packet instanceof PacketPlayInArmAnimation)) {
|
|
- connection.killAuraNStage = 1;
|
|
- }
|
|
- } else if (connection.killAuraNStage == 1) {
|
|
- if (((packet instanceof PacketPlayInBlockDig)) && (((PacketPlayInBlockDig)packet).g() == 0)) {
|
|
- connection.killAuraNStage = 2;
|
|
- } else {
|
|
- connection.killAuraNStage = 0;
|
|
- }
|
|
- } else if (connection.killAuraNStage == 2) {
|
|
- if ((packet instanceof PacketPlayInFlying)) {
|
|
- connection.killAuraNStage = 3;
|
|
- } else {
|
|
- connection.killAuraNStage = 0;
|
|
- }
|
|
- } else if (connection.killAuraNStage == 3) {
|
|
- if (((packet instanceof PacketPlayInBlockDig)) && (((PacketPlayInBlockDig)packet).g() == 1)) {
|
|
- if (++connection.killAuraQThreshold == 5) {
|
|
- connection.killAuraQThreshold = 0;
|
|
-
|
|
- String message = connection.getPlayer().getName() + " is using Kill Aura (Module NX)";
|
|
- runSync(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.KILL_AURA, "N", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- );
|
|
- }
|
|
- }
|
|
- connection.killAuraNStage = 0;
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- // KillAura Module X
|
|
- if ((packet instanceof PacketPlayInArmAnimation)) {
|
|
- connection.killAuraXSwing = true;
|
|
- }
|
|
-
|
|
- if ((connection.movesReceived > 20L) && (getVersion() <= 47) && (!connection.killAuraXSwing) && Bukkit.shouldGuardianAct() && ((packet instanceof PacketPlayInUseEntity)) && (((PacketPlayInUseEntity)packet).c() == EnumEntityUseAction.ATTACK)) {
|
|
- String message = connection.getPlayer().getName() + " is using Kill Aura (Module X)";
|
|
- runSync(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.KILL_AURA, "X", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- );
|
|
- }
|
|
-
|
|
- if (Bukkit.shouldGuardianAct()) {
|
|
- // Criticals Module B
|
|
- if (((packet instanceof PacketPlayInFlying)) && (((PacketPlayInFlying)packet).hasPos)) {
|
|
- if (((PacketPlayInFlying)packet).i()) {
|
|
- connection.criticalBStage = 1;
|
|
- connection.criticalBY = ((PacketPlayInFlying)packet).d();
|
|
- } else if ((connection.criticalBStage == 1) && (((PacketPlayInFlying)packet).d() < connection.criticalBY)) {
|
|
- connection.criticalBStage = 2;
|
|
- connection.criticalBHeight = (connection.criticalBY - ((PacketPlayInFlying)packet).d());
|
|
- connection.criticalBY = ((PacketPlayInFlying)packet).d();
|
|
- } else if ((connection.criticalBStage == 2) && (((PacketPlayInFlying)packet).d() > connection.criticalBY)) {
|
|
- connection.criticalBStage = 3;
|
|
- connection.criticalBY = ((PacketPlayInFlying)packet).d();
|
|
- } else if ((connection.criticalBStage == 3) && (((PacketPlayInFlying)packet).d() < connection.criticalBY)) {
|
|
- connection.criticalBStage = 4;
|
|
- connection.criticalBY = ((PacketPlayInFlying)packet).d();
|
|
- } else {
|
|
- connection.criticalBStage = 0;
|
|
- }
|
|
- } else {
|
|
- if (((packet instanceof PacketPlayInArmAnimation)) && (connection.criticalBStage == 4)) {
|
|
- String message = String.format("%s is using Criticals (Module B) [%.4f]", connection.getPlayer().getName(), connection.criticalBHeight);
|
|
- runSync(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.CRITICALS, "B", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- .addData("height", connection.criticalBHeight)
|
|
- );
|
|
- }
|
|
-
|
|
- connection.criticalBStage = 0;
|
|
- }
|
|
- }
|
|
-
|
|
- if (getVersion() <= 47) {
|
|
- // Bad Packets Module A
|
|
- if (connection.justSentSprint) {
|
|
- if ((packet instanceof PacketPlayInFlying)) {
|
|
- connection.justSentSprint = false;
|
|
- } else if (((packet instanceof PacketPlayInEntityAction)) && ((((PacketPlayInEntityAction)packet).d() == 1) || (((PacketPlayInEntityAction)packet).d() == 2))) {
|
|
- connection.justSentSprint = false;
|
|
- } else {
|
|
- long now = System.currentTimeMillis();
|
|
- if (now - connection.lastSprintViolationTime > 1000L) {
|
|
- connection.lastSprintViolationTime = now;
|
|
-
|
|
- String message = connection.getPlayer().getName() + " sent Bad Packets (Module A) [" + packet.getClass().getSimpleName() + "]";
|
|
- runSync(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.GENERAL, "A", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- .addData("packet", packet.getClass().getSimpleName())
|
|
- );
|
|
- }
|
|
- connection.justSentSprint = false;
|
|
- }
|
|
- }
|
|
- if (((packet instanceof PacketPlayInEntityAction)) && ((((PacketPlayInEntityAction)packet).d() == 4) || (((PacketPlayInEntityAction)packet).d() == 5))) {
|
|
- connection.justSentSprint = true;
|
|
+ if (this.o instanceof PlayerConnection) {
|
|
+ try {
|
|
+ for (PacketHandler handler : HylistSpigot.INSTANCE.getPacketHandlers()) {
|
|
+ handler.handleReceivedPacket((PlayerConnection) this.o, packet);
|
|
}
|
|
+ } catch (Exception e) {
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
- // Guardian end
|
|
+ } else {
|
|
this.k.add(packet);
|
|
}
|
|
}
|
|
@@ -486,206 +289,16 @@ public class NetworkManager extends SimpleChannelInboundHandler {
|
|
|
|
if (((packet instanceof PacketPlayInChat)) || ((packet instanceof PacketPlayInCustomPayload))) {
|
|
packet.handle(this.o);
|
|
- continue;
|
|
- }
|
|
|
|
- if (Bukkit.shouldGuardianAct() && !MinecraftServer.getServer().getAllowFlight() && !connection.player.abilities.canFly && !connection.player.abilities.canInstantlyBuild) {
|
|
- boolean eventFired = false;
|
|
- int size = connection.lastPacketsQueue.size();
|
|
- if (size >= this.packets.length) {
|
|
- if (((packet instanceof PacketPlayInUseEntity)) && (((PacketPlayInUseEntity)packet).c() == EnumEntityUseAction.ATTACK)) {
|
|
- for (int j = 0; j < this.packets.length; j++) {
|
|
- this.packets[j] = connection.lastPacketsQueue.removeLast();
|
|
- }
|
|
-
|
|
- Class packet0Class = this.packets[0].getClass();
|
|
- if (packet0Class.equals(PacketPlayInArmAnimation.class)) {
|
|
- if ((this.packets[1].getClass().equals(PacketPlayInUseEntity.class)) && (this.packets[2].getClass().equals(PacketPlayInArmAnimation.class)) && (((PacketPlayInUseEntity)this.packets[1]).c() == EnumEntityUseAction.ATTACK) && (getVersion() <= 47)) {
|
|
- if ((this.packets[3].getClass().equals(PacketPlayInUseEntity.class)) && (this.packets[4].getClass().equals(PacketPlayInArmAnimation.class)) && (((PacketPlayInUseEntity)this.packets[3]).c() == EnumEntityUseAction.ATTACK)) {
|
|
- if ((this.packets[5].getClass().equals(PacketPlayInUseEntity.class)) && (this.packets[6].getClass().equals(PacketPlayInArmAnimation.class)) && (((PacketPlayInUseEntity)this.packets[5]).c() == EnumEntityUseAction.ATTACK)) {
|
|
- if ((this.packets[7].getClass().equals(PacketPlayInUseEntity.class)) && (this.packets[8].getClass().equals(PacketPlayInArmAnimation.class)) && (((PacketPlayInUseEntity)this.packets[7]).c() == EnumEntityUseAction.ATTACK)) {
|
|
- if (this.lastKillAuraKTick != MinecraftServer.currentTick) {
|
|
- String message = connection.getPlayer().getName() + " is using Kill Aura (Module KX) [" + this.ticksSinceLastPacket + "]";
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.KILL_AURA, "K", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- .addData("ticksSinceLastPacket", ticksSinceLastPacket)
|
|
- );
|
|
-
|
|
- this.lastKillAuraKTick = MinecraftServer.currentTick;
|
|
- }
|
|
- } else {
|
|
- String message = connection.getPlayer().getName() + " is using Kill Aura (Module SX) [" + this.ticksSinceLastPacket + "]";
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.KILL_AURA, "S", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- .addData("ticksSinceLastPacket", ticksSinceLastPacket)
|
|
- );
|
|
- }
|
|
- } else {
|
|
- this.numOfKillAuraTLogs.add(this.ticksSinceLastPacket);
|
|
- if (++this.numOfT == 3) {
|
|
- String message = connection.getPlayer().getName() + " is using Kill Aura (Module T) [" + Joiner.on(" ").join(this.numOfKillAuraTLogs) + "]";
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.KILL_AURA, "T", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- .addData("logs", Joiner.on(" ").join(this.numOfKillAuraTLogs))
|
|
- );
|
|
-
|
|
- this.numOfT = 0;
|
|
- this.numOfKillAuraTLogs.clear();
|
|
- }
|
|
- }
|
|
- } else {
|
|
- this.numOfKillAuraBLogs.add(this.ticksSinceLastPacket);
|
|
- if (++this.numOfKillAuraB == 5) {
|
|
- String message = connection.getPlayer().getName() + " is using Kill Aura (Module B) [" + Joiner.on(" ").join(this.numOfKillAuraBLogs) + "]";
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.KILL_AURA, "B", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- .addData("logs", Joiner.on(" ").join(this.numOfKillAuraBLogs))
|
|
- );
|
|
-
|
|
- this.numOfKillAuraB = 0;
|
|
- this.numOfKillAuraBLogs.clear();
|
|
- }
|
|
- }
|
|
- } else {
|
|
- int numberOfPreviousPacketPlayInPositionLooks = 0;
|
|
- boolean foundPrevHitPacket = false;
|
|
- for (int j = 1; j < this.packets.length; j++) {
|
|
- Class packetJClass = this.packets[j].getClass();
|
|
- if ((packetJClass.equals(PacketPlayInPositionLook.class)) || (packetJClass.equals(PacketPlayInPosition.class)) || (packetJClass.equals(PacketPlayInLook.class)) || (packetJClass.equals(PacketPlayInFlying.class))) {
|
|
- numberOfPreviousPacketPlayInPositionLooks++;
|
|
- foundPrevHitPacket = true;
|
|
- } else {
|
|
- if (packetJClass.equals(PacketPlayInUseEntity.class)) {
|
|
- break;
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- if (foundPrevHitPacket) {
|
|
- PacketPlayInUseEntity packetPlayInUseEntity = (PacketPlayInUseEntity)packet;
|
|
- EnumEntityUseAction action = packetPlayInUseEntity.c();
|
|
- WorldServer worldserver = MinecraftServer.getServer().getWorldServer(connection.player.dimension);
|
|
- Entity entity = packetPlayInUseEntity.a(worldserver);
|
|
-
|
|
- boolean validData;
|
|
- validData = (action == EnumEntityUseAction.ATTACK) && (entity != connection.player) && (entity != null) && ((entity instanceof EntityPlayer));
|
|
-
|
|
- if (validData) {
|
|
- EntityPlayer entityPlayer = (EntityPlayer)entity;
|
|
- validData = entityPlayer.playerConnection.hasMovedInHalfSecond;
|
|
- }
|
|
-
|
|
- if (validData) {
|
|
- List<Long> times = connection.killAuraFViolations.get(numberOfPreviousPacketPlayInPositionLooks);
|
|
-
|
|
- if (connection.killAuraFViolations.size() > 1) {
|
|
- connection.killAuraFViolations.clear();
|
|
- }
|
|
-
|
|
- if (times == null) {
|
|
- times = new ArrayList<Long>();
|
|
- connection.killAuraFViolations.put(numberOfPreviousPacketPlayInPositionLooks, times);
|
|
- }
|
|
-
|
|
- long currentTime = System.currentTimeMillis();
|
|
- int typeCViolations = 0;
|
|
- times.add(currentTime);
|
|
-
|
|
- for (Iterator<Long> iterator = times.iterator(); iterator.hasNext();) {
|
|
- Long time = iterator.next();
|
|
- long timeLimiter = numberOfPreviousPacketPlayInPositionLooks < 12 ? this.limitTimes[numberOfPreviousPacketPlayInPositionLooks] : 4000L;
|
|
-
|
|
- if (time + timeLimiter >= currentTime) {
|
|
- typeCViolations++;
|
|
- } else {
|
|
- iterator.remove();
|
|
- }
|
|
- }
|
|
-
|
|
- if (typeCViolations >= 10) {
|
|
- String message = connection.getPlayer().getName() + " is using Kill Aura (Module FX) [" + numberOfPreviousPacketPlayInPositionLooks + "]";
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.KILL_AURA, "F", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- .addData("packets", numberOfPreviousPacketPlayInPositionLooks)
|
|
- );
|
|
-
|
|
- times.clear();
|
|
- eventFired = true;
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- for (int j = this.packets.length - 1; j >= 0; j--) {
|
|
- connection.lastPacketsQueue.add(this.packets[j]);
|
|
- }
|
|
- } else if ((packet instanceof PacketPlayInBlockPlace)) {
|
|
- for (int j = 0; j < 3; j++) {
|
|
- this.packets[j] = connection.lastPacketsQueue.removeLast();
|
|
- }
|
|
-
|
|
- if (((this.packets[0] instanceof PacketPlayInFlying)) && ((this.packets[1] instanceof PacketPlayInBlockPlace)) && ((this.packets[2] instanceof PacketPlayInBlockDig))) {
|
|
- String message = connection.getPlayer().getName() + " is eating or shooting too fast (Module A)";
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.FAST_USE, "A", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- );
|
|
- }
|
|
-
|
|
- for (int j = 2; j >= 0; j--) {
|
|
- connection.lastPacketsQueue.add(this.packets[j]);
|
|
- }
|
|
- } else if ((packet instanceof PacketPlayInHeldItemSlot)) {
|
|
- for (int j = 0; j < 3; j++) {
|
|
- this.packets[j] = connection.lastPacketsQueue.removeLast();
|
|
- }
|
|
- if (((this.packets[0] instanceof PacketPlayInBlockPlace)) && ((this.packets[1] instanceof PacketPlayInFlying)) && ((this.packets[2] instanceof PacketPlayInBlockDig))) {
|
|
- String message = connection.getPlayer().getName() + " is eating or shooting too fast (Module B)";
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.FAST_USE, "B", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- );
|
|
- }
|
|
- for (int j = 2; j >= 0; j--) {
|
|
- connection.lastPacketsQueue.add(this.packets[j]);
|
|
- }
|
|
- } if (connection.isDigging) {
|
|
- if ((packet instanceof PacketPlayInFlying)) {
|
|
- connection.killAuraRStage = 1;
|
|
- } else if ((packet instanceof PacketPlayInArmAnimation)) {
|
|
- if (connection.killAuraRStage == 1) {
|
|
- connection.killAuraRStage = 2;
|
|
- } else if (connection.killAuraRStage == 2) {
|
|
- connection.killAuraRStage = 0;
|
|
-
|
|
- if (connection.digHorizontalMovement > 1) {
|
|
- connection.killAuraRThreshold += 1;
|
|
-
|
|
- if (connection.killAuraRThreshold >= 3) {
|
|
- String message = connection.getPlayer().getName() + " is using Kill Aura (Module RX) [" + connection.killAuraRThreshold + "]";
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(connection.getPlayer(), GuardianEvent.Cheat.KILL_AURA, "R", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- .addData("threshold", connection.killAuraRThreshold)
|
|
- );
|
|
- }
|
|
- }
|
|
- }
|
|
- } else {
|
|
- connection.killAuraRStage = 0;
|
|
- }
|
|
- } else {
|
|
- connection.killAuraRStage = 0;
|
|
+ try {
|
|
+ for (PacketHandler handler : HylistSpigot.INSTANCE.getPacketHandlers()) {
|
|
+ handler.handleReceivedPacket((PlayerConnection) this.o, packet);
|
|
}
|
|
+ } catch (Exception e) {
|
|
+ e.printStackTrace();
|
|
}
|
|
|
|
- if (size == 10) {
|
|
- connection.lastPacketsQueue.removeFirst();
|
|
- }
|
|
-
|
|
- connection.lastPacketsQueue.add(packet);
|
|
-
|
|
- if (eventFired) {
|
|
- connection.lastPacketsQueue.clear();
|
|
- }
|
|
+ continue;
|
|
}
|
|
}
|
|
// Guardian end
|
|
@@ -698,7 +311,19 @@ public class NetworkManager extends SimpleChannelInboundHandler {
|
|
} finally {
|
|
packetHandlerTimer.stopTiming();
|
|
}
|
|
+
|
|
+ if (this.o instanceof PlayerConnection) {
|
|
+ try {
|
|
+ for (PacketHandler handler : HylistSpigot.INSTANCE.getPacketHandlers()) {
|
|
+ handler.handleReceivedPacket((PlayerConnection) this.o, packet);
|
|
+ }
|
|
+ } catch (Exception e) {
|
|
+ e.printStackTrace();
|
|
+ }
|
|
+ }
|
|
// Poweruser end
|
|
+
|
|
+
|
|
}
|
|
|
|
this.o.a();
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java
|
|
index dfa68b02..3a1a5a59 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java
|
|
@@ -7,6 +7,7 @@ public class PacketPlayOutBlockChange extends Packet {
|
|
private int c;
|
|
public Block block; // CraftBukkit - public
|
|
public int data; // CraftBukkit - public
|
|
+ public boolean fake = false;
|
|
|
|
public PacketPlayOutBlockChange() {}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
|
index 749b32d5..be485293 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
|
@@ -2,13 +2,13 @@ package net.minecraft.server;
|
|
|
|
public class PacketPlayOutEntity extends Packet {
|
|
|
|
- protected int a;
|
|
- protected byte b;
|
|
- protected byte c;
|
|
- protected byte d;
|
|
- protected byte e;
|
|
- protected byte f;
|
|
- protected boolean g;
|
|
+ public int a;
|
|
+ public byte b;
|
|
+ public byte c;
|
|
+ public byte d;
|
|
+ public byte e;
|
|
+ public byte f;
|
|
+ public boolean g;
|
|
|
|
public PacketPlayOutEntity() {}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
|
|
index 921561c3..3b8dea50 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
|
|
@@ -2,14 +2,14 @@ package net.minecraft.server;
|
|
|
|
public class PacketPlayOutEntityTeleport extends Packet {
|
|
|
|
- private int a;
|
|
- private int b;
|
|
- private int c;
|
|
- private int d;
|
|
- private byte e;
|
|
- private byte f;
|
|
- private boolean onGround; // Spigot - protocol patch
|
|
- private boolean heightCorrection; // Spigot Update - 20140916a
|
|
+ public int a;
|
|
+ public int b;
|
|
+ public int c;
|
|
+ public int d;
|
|
+ public byte e;
|
|
+ public byte f;
|
|
+ public boolean onGround; // Spigot - protocol patch
|
|
+ public boolean heightCorrection; // Spigot Update - 20140916a
|
|
|
|
public PacketPlayOutEntityTeleport() {}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutExplosion.java b/src/main/java/net/minecraft/server/PacketPlayOutExplosion.java
|
|
new file mode 100644
|
|
index 00000000..d11dd3ff
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutExplosion.java
|
|
@@ -0,0 +1,83 @@
|
|
+package net.minecraft.server;
|
|
+
|
|
+import java.util.ArrayList;
|
|
+import java.util.List;
|
|
+
|
|
+public class PacketPlayOutExplosion extends Packet
|
|
+{
|
|
+ private double a;
|
|
+ private double b;
|
|
+ private double c;
|
|
+ private float d;
|
|
+ private List e;
|
|
+ public float f;
|
|
+ public float g;
|
|
+ public float h;
|
|
+
|
|
+ public PacketPlayOutExplosion() {
|
|
+ }
|
|
+
|
|
+ public PacketPlayOutExplosion(final double a, final double b, final double c, final float d, final List list, final Vec3D vec3D) {
|
|
+ this.a = a;
|
|
+ this.b = b;
|
|
+ this.c = c;
|
|
+ this.d = d;
|
|
+ this.e = new ArrayList(list);
|
|
+ if (vec3D != null) {
|
|
+ this.f = (float)vec3D.a;
|
|
+ this.g = (float)vec3D.b;
|
|
+ this.h = (float)vec3D.c;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void a(final PacketDataSerializer packetDataSerializer) {
|
|
+ this.a = packetDataSerializer.readFloat();
|
|
+ this.b = packetDataSerializer.readFloat();
|
|
+ this.c = packetDataSerializer.readFloat();
|
|
+ this.d = packetDataSerializer.readFloat();
|
|
+ final int int1 = packetDataSerializer.readInt();
|
|
+ this.e = new ArrayList(int1);
|
|
+ final int n = (int)this.a;
|
|
+ final int n2 = (int)this.b;
|
|
+ final int n3 = (int)this.c;
|
|
+ for (int i = 0; i < int1; ++i) {
|
|
+ this.e.add(new ChunkPosition(packetDataSerializer.readByte() + n, packetDataSerializer.readByte() + n2, packetDataSerializer.readByte() + n3));
|
|
+ }
|
|
+ this.f = packetDataSerializer.readFloat();
|
|
+ this.g = packetDataSerializer.readFloat();
|
|
+ this.h = packetDataSerializer.readFloat();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void b(final PacketDataSerializer packetDataSerializer) {
|
|
+ packetDataSerializer.writeFloat((float)this.a);
|
|
+ packetDataSerializer.writeFloat((float)this.b);
|
|
+ packetDataSerializer.writeFloat((float)this.c);
|
|
+ packetDataSerializer.writeFloat(this.d);
|
|
+ packetDataSerializer.writeInt(this.e.size());
|
|
+ final int n = (int)this.a;
|
|
+ final int n2 = (int)this.b;
|
|
+ final int n3 = (int)this.c;
|
|
+ for (final Object object : this.e) {
|
|
+ ChunkPosition chunkPosition = (ChunkPosition) object;
|
|
+ final int i = chunkPosition.x - n;
|
|
+ final int j = chunkPosition.y - n2;
|
|
+ final int k = chunkPosition.z - n3;
|
|
+ packetDataSerializer.writeByte(i);
|
|
+ packetDataSerializer.writeByte(j);
|
|
+ packetDataSerializer.writeByte(k);
|
|
+ }
|
|
+ packetDataSerializer.writeFloat(this.f);
|
|
+ packetDataSerializer.writeFloat(this.g);
|
|
+ packetDataSerializer.writeFloat(this.h);
|
|
+ }
|
|
+
|
|
+ public void a(final PacketPlayOutListener packetPlayOutListener) {
|
|
+ packetPlayOutListener.a(this);
|
|
+ }
|
|
+
|
|
+ public void handle(PacketListener packetlistener) {
|
|
+ this.a((PacketPlayOutListener) packetlistener);
|
|
+ }
|
|
+}
|
|
\ No newline at end of file
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java
|
|
index e9ff5ee1..e5feea62 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutKeepAlive.java
|
|
@@ -37,4 +37,8 @@ public class PacketPlayOutKeepAlive extends Packet {
|
|
public void handle(PacketListener packetlistener) {
|
|
this.a((PacketPlayOutListener) packetlistener);
|
|
}
|
|
+
|
|
+ public int getA() {
|
|
+ return this.a;
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java
|
|
index 3acf11d0..2abaf4e5 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMultiBlockChange.java
|
|
@@ -17,6 +17,7 @@ public class PacketPlayOutMultiBlockChange extends Packet {
|
|
private short[] ashort;
|
|
private int[] blocks;
|
|
// Spigot end
|
|
+ public boolean fake = false;
|
|
|
|
public PacketPlayOutMultiBlockChange() {}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java
|
|
index ddbd1e8c..7b88ddb8 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutPosition.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutPosition.java
|
|
@@ -2,13 +2,13 @@ package net.minecraft.server;
|
|
|
|
public class PacketPlayOutPosition extends Packet {
|
|
|
|
- private double a;
|
|
- private double b;
|
|
- private double c;
|
|
- private float d;
|
|
- private float e;
|
|
- private boolean f;
|
|
- private byte relativeBitMask; // Spigot Update - 20141001a
|
|
+ public double a;
|
|
+ public double b;
|
|
+ public double c;
|
|
+ public float d;
|
|
+ public float e;
|
|
+ public boolean f;
|
|
+ public byte relativeBitMask; // Spigot Update - 20141001a
|
|
|
|
public PacketPlayOutPosition() {}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java
|
|
index 37e5a387..e2ef02c7 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutRelEntityMove.java
|
|
@@ -39,6 +39,6 @@ public class PacketPlayOutRelEntityMove extends PacketPlayOutEntity {
|
|
}
|
|
|
|
public void handle(PacketListener packetlistener) {
|
|
- super.a((PacketPlayOutListener) packetlistener);
|
|
+ this.a((PacketPlayOutListener) packetlistener);
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
index da157b46..a8b3b3dd 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -1,6 +1,9 @@
|
|
package net.minecraft.server;
|
|
|
|
import net.frozenorb.util.BlockUtil;
|
|
+import net.hylist.HylistSpigot;
|
|
+import net.hylist.handler.MovementHandler;
|
|
+import net.hylist.handler.PacketHandler;
|
|
import net.minecraft.util.com.google.common.base.Charsets;
|
|
import net.minecraft.util.com.google.common.collect.Lists;
|
|
import net.minecraft.util.io.netty.buffer.Unpooled;
|
|
@@ -84,59 +87,13 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
// Poweruser end
|
|
|
|
// Guardian start
|
|
- public static final int MAX_IN_COMBAT_SPEED_PACKETS = 10;
|
|
- public static final int MAX_NOT_IN_COMBAT_SPEED_PACKETS = 5;
|
|
-
|
|
public int packetsNotReceived = 0;
|
|
public long lastKeepAlivePacketReceived = -1;
|
|
|
|
- public double lastGroundY = -1D;
|
|
-
|
|
- public long lastHitByExplosion = -1L;
|
|
- public long lastHit = -1L;
|
|
-
|
|
- public int hoverPackets = 0;
|
|
- public int speedPackets = 0;
|
|
- public int notHitPackets = 3;
|
|
- public double lastSpeedDistance = -1D;
|
|
-
|
|
- public int lastMajorPacketProcessed = MinecraftServer.currentTick;
|
|
- public int packetsReceivedSinceLastMajorTick = 0;
|
|
- public boolean processedMajorTick = false;
|
|
- public double averageMaxPacketsPerSecond = 2.5D;
|
|
-
|
|
- public boolean lastHasPos;
|
|
- public boolean lastHasLook;
|
|
-
|
|
- public int lastFuckedUpPacketReceivedTick = 0;
|
|
- public long lastCheckedFuckedUpPacketReceivedTick = 0;
|
|
- public int morePacketStrikes = 0;
|
|
-
|
|
- public double lastBlockGlitchFromX = 0.0D;
|
|
- public double lastBlockGlitchFromZ = 0.0D;
|
|
- public double lastBlockGlitchToX = 0.0D;
|
|
- public double lastBlockGlitchToZ = 0.0D;
|
|
-
|
|
- public long movesReceived = 0L;
|
|
-
|
|
public LinkedList<Packet> lastPacketsQueue = new LinkedList<Packet>();
|
|
|
|
- public int killAuraTypeAViolations = 0;
|
|
- public int killAuraTypeBViolations = 0;
|
|
- public Map<Integer, List<Long>> killAuraFViolations = new HashMap<Integer, List<Long>>();
|
|
-
|
|
- public long lastCalculatedHalfSecondTime = 0L;
|
|
- public double lastHalfSecondX = 0D;
|
|
- public double lastHalfSecondY = -1D;
|
|
- public double lastHalfSecondZ = 0D;
|
|
- public boolean hasMovedInHalfSecond;
|
|
-
|
|
public Set<Integer> keepAlives = new HashSet<Integer>();
|
|
|
|
- public double lastHitMotionX = 10000.0D;
|
|
- public double lastHitMotionY = 10000.0D;
|
|
- public double lastHitMotionZ = 10000.0D;
|
|
-
|
|
public long lastMotionTick = 0L;
|
|
public int antiKBViolations = 0;
|
|
|
|
@@ -148,46 +105,10 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
public boolean isDigging = false;
|
|
public int digHorizontalMovement = 0;
|
|
|
|
- public int killAuraRStage = 0;
|
|
- public int killAuraRThreshold = 0;
|
|
- public int autoclickerAStage = 0;
|
|
- public int autoclickerAThreshold = 0;
|
|
- public int autoClickerBStage = 0;
|
|
- public int autoClickerBThreshold = 0;
|
|
- public int killAuraTypePOther = 0;
|
|
- public int killAuraNStage = 0;
|
|
- public int killAuraQThreshold = 0;
|
|
- public boolean killAuraXSwing = false;
|
|
-
|
|
public final List<PacketPlayOutEntityVelocity> velocitiesSent = new ArrayList<PacketPlayOutEntityVelocity>();
|
|
public final List<Long> velocitySentTimes = new ArrayList<Long>();
|
|
public long positionSentTime = System.currentTimeMillis();
|
|
|
|
- public int reducedKbAmount = 0;
|
|
-
|
|
- public int miniJumpAmount = 0;
|
|
-
|
|
- public double horizontalSpeed = 1.0D;
|
|
- public double newHorizontalSpeed = 0.0D;
|
|
- public long newHorizontalSpeedTime;
|
|
- public double blockFriction = 0.0D;
|
|
- public int blockFrictionX = Integer.MAX_VALUE;
|
|
- public int blockFrictionY = Integer.MAX_VALUE;
|
|
- public int blockFrictionZ = Integer.MAX_VALUE;
|
|
- public double previousHorizontalMove = 0.0D;
|
|
-
|
|
- public int flyTypeDAmount = 0;
|
|
-
|
|
- public int speedTypeDAmount = 0;
|
|
-
|
|
- public int criticalBStage = 0;
|
|
- public double criticalBY;
|
|
- public double criticalBHeight = 0.0D;
|
|
-
|
|
- public boolean justSentSprint = false;
|
|
- public long lastSpeedTime = -1L;
|
|
- public long lastSprintViolationTime = System.currentTimeMillis();
|
|
- private long lastJumpEffectTime = System.currentTimeMillis();
|
|
private long lastKickedForFly;
|
|
|
|
|
|
@@ -350,60 +271,6 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
// CraftBukkit end
|
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
|
|
|
- // Guardian start: Timer
|
|
- long numOfTicksSinceLastPacket = this.networkManager.ticksSinceLastPacket;
|
|
- if (Bukkit.shouldGuardianAct() && !this.player.abilities.canFly && this.player.vehicle == null) {
|
|
- if (networkManager.currentTime - this.positionSentTime > 1000L) {
|
|
- if ((this.lastFuckedUpPacketReceivedTick == MinecraftServer.currentTick) && (this.lastCheckedFuckedUpPacketReceivedTick != MinecraftServer.currentTick) && (packetplayinflying.hasPos != this.lastHasPos) && (packetplayinflying.hasLook != this.lastHasLook)) {
|
|
- this.lastCheckedFuckedUpPacketReceivedTick = MinecraftServer.currentTick;
|
|
- } else {
|
|
- this.packetsReceivedSinceLastMajorTick += 1L;
|
|
- this.lastFuckedUpPacketReceivedTick = MinecraftServer.currentTick;
|
|
- this.lastHasPos = packetplayinflying.hasPos;
|
|
- this.lastHasLook = packetplayinflying.hasLook;
|
|
- }
|
|
-
|
|
- if ((!this.processedMajorTick) && (this.lastMajorPacketProcessed + 20L < MinecraftServer.currentTick)) {
|
|
- long diff = MinecraftServer.currentTick - this.lastMajorPacketProcessed;
|
|
- this.lastMajorPacketProcessed = MinecraftServer.currentTick;
|
|
- this.processedMajorTick = true;
|
|
-
|
|
- if (numOfTicksSinceLastPacket > 20L) {
|
|
- this.packetsReceivedSinceLastMajorTick = 0;
|
|
- this.lastFuckedUpPacketReceivedTick = 0;
|
|
- this.lastCheckedFuckedUpPacketReceivedTick = 0L;
|
|
- this.lastHasPos = false;
|
|
- this.lastHasLook = false;
|
|
- }
|
|
-
|
|
- if ((numOfTicksSinceLastPacket <= 20L) && (packetsReceivedSinceLastMajorTick / diff >= averageMaxPacketsPerSecond)) {
|
|
-
|
|
- if (++this.morePacketStrikes >= 3L) {
|
|
- String message = this.player.getName() + " uses Timer Modifications (Module A) [P:" + packetsReceivedSinceLastMajorTick + "]";
|
|
-
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(getPlayer(), GuardianEvent.Cheat.TIMER, "A", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- .addData("packets", packetsReceivedSinceLastMajorTick)
|
|
- );
|
|
- }
|
|
- } else if (this.morePacketStrikes > 0L) {
|
|
- this.morePacketStrikes -= 1L;
|
|
- }
|
|
-
|
|
- this.packetsReceivedSinceLastMajorTick = 0;
|
|
- this.lastFuckedUpPacketReceivedTick = 0;
|
|
- this.lastCheckedFuckedUpPacketReceivedTick = 0L;
|
|
- this.lastHasPos = false;
|
|
- this.lastHasLook = false;
|
|
- }
|
|
-
|
|
- else if (MinecraftServer.currentTick % 20 != 0) {
|
|
- this.processedMajorTick = false;
|
|
- }
|
|
- }
|
|
- }
|
|
- // Guardian end: Timer
|
|
-
|
|
this.g = true;
|
|
if (!this.player.viewingCredits) {
|
|
double d0;
|
|
@@ -447,127 +314,33 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
to.setPitch(packetplayinflying.pitch);
|
|
}
|
|
|
|
- // Guardian start: Anti-KB
|
|
- if (Bukkit.shouldGuardianAct() && !this.player.abilities.canFly && this.player.vehicle == null) {
|
|
- if (this.lastMotionTick != 0L) {
|
|
- if (this.lastMotionTick + 20L < MinecraftServer.currentTick) {
|
|
- this.lastMotionTick = 0L;
|
|
- this.lastHitMotionX = (this.lastHitMotionY = this.lastHitMotionZ = 0.0D);
|
|
-
|
|
- if (lastKeepAlivePacketReceived + 800L > networkManager.currentTime) {
|
|
- if (++antiKBViolations >= 3) {
|
|
- String message = String.format("%s uses Client Modifications (Module K) at %.1f %.1f %.1f", player.getName(), to.getX(), to.getY(), to.getZ());
|
|
-
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(getPlayer(), GuardianEvent.Cheat.CLIENT_MODIFICATIONS, "K", GuardianEvent.DisplayLevel.HIGHEST, message, new Location(player.getWorld(), to.getX(), to.getY(), to.getZ()))
|
|
- );
|
|
- antiKBViolations = 0;
|
|
- }
|
|
- }
|
|
- } else if (!packetplayinflying.i()) {
|
|
- this.lastMotionTick = 0L;
|
|
- this.lastHitMotionX = (this.lastHitMotionY = this.lastHitMotionZ = 0.0D);
|
|
-
|
|
- if (this.antiKBViolations > 0) {
|
|
- this.antiKBViolations -= 1;
|
|
- }
|
|
- }
|
|
- }
|
|
- } else {
|
|
- this.lastMotionTick = 0L;
|
|
- this.lastHitMotionX = (this.lastHitMotionY = this.lastHitMotionZ = 0.0D);
|
|
- }
|
|
- // Guardian end: Anti-KB
|
|
-
|
|
// Prevent 40 event-calls for less than a single pixel of movement >.>
|
|
double delta = Math.pow(this.lastPosX - to.getX(), 2) + Math.pow(this.lastPosY - to.getY(), 2) + Math.pow(this.lastPosZ - to.getZ(), 2);
|
|
float deltaAngle = Math.abs(this.lastYaw - to.getYaw()) + Math.abs(this.lastPitch - to.getPitch());
|
|
|
|
- // AGC start
|
|
- if (packetplayinflying.hasPos && delta > 0.0 && this.checkMovement && !this.player.dead) {
|
|
- if (!player.getAllowFlight() && !player.isInsideVehicle() && this.player.lastDamageByPlayerTime + 100 < MinecraftServer.currentTick && this.lastVelocitySentTick + 100 < MinecraftServer.currentTick) {
|
|
- final double offsetHSquared = Math.pow(to.getX() - from.getX(), 2) + Math.pow(to.getZ() - from.getZ(), 2);
|
|
- int speed = 0;
|
|
- for (final PotionEffect effect : this.player.getBukkitEntity().getActivePotionEffects()) {
|
|
- if (effect.getType().equals(PotionEffectType.SPEED)) {
|
|
- speed = effect.getAmplifier() + 1;
|
|
- break;
|
|
- }
|
|
- }
|
|
-
|
|
- double limit;
|
|
- if (BlockUtil.isOnGround(to, 0) || BlockUtil.isOnGround(to, 1)) {
|
|
- limit = 0.34;
|
|
- if (BlockUtil.isOnStairs(to, 0) || BlockUtil.isOnStairs(to, 1)) {
|
|
- limit = 0.45;
|
|
- } else if (BlockUtil.isOnIce(to, 0) || BlockUtil.isOnIce(to, 1)) {
|
|
- if (BlockUtil.isOnGround(to, -2)) {
|
|
- limit = 1.3;
|
|
- } else {
|
|
- limit = 0.65;
|
|
- }
|
|
- } else if (BlockUtil.isOnGround(to, -2)) {
|
|
- limit = 0.7;
|
|
- }
|
|
- limit += ((player.getWalkSpeed() > 0.2f) ? (player.getWalkSpeed() * 10.0f * 0.33f) : 0.0f);
|
|
- limit += 0.06 * speed;
|
|
- } else {
|
|
- limit = 0.36;
|
|
- if (BlockUtil.isOnStairs(to, 0) || BlockUtil.isOnStairs(to, 1)) {
|
|
- limit = 0.45;
|
|
- } else if (BlockUtil.isOnIce(to, 0) || BlockUtil.isOnIce(to, 1)) {
|
|
- if (BlockUtil.isOnGround(to, -2)) {
|
|
- limit = 1.3;
|
|
- } else {
|
|
- limit = 0.65;
|
|
- }
|
|
- } else if (BlockUtil.isOnGround(to, -2)) {
|
|
- limit = 0.7;
|
|
- }
|
|
-
|
|
- limit += ((player.getWalkSpeed() > 0.2f) ? (player.getWalkSpeed() * 10.0f * 0.33f) : 0.0f);
|
|
- limit += 0.02 * speed;
|
|
- } if (offsetHSquared > Math.pow(limit, 2)) {
|
|
- ++this.illegalMovements;
|
|
- } else {
|
|
- ++this.legalMovements;
|
|
- }
|
|
-
|
|
- final int total = this.illegalMovements + this.legalMovements;
|
|
- if (total >= 20) {
|
|
- final double percentage = this.illegalMovements / 20.0 * 100.0;
|
|
- if (percentage >= 45.0 && this.player.getEffects().isEmpty()) {
|
|
- String message = String.format("%s is flying at %.1f %.1f %.1f. [%d%%]", this.player.getName(), to.getX(), to.getY(), to.getZ(), (int) percentage);
|
|
- Bukkit.getPluginManager().callEvent(new GuardianEvent(player, GuardianEvent.Cheat.FLY_HACKS, "E", DisplayLevel.HIGH, message, to));
|
|
- }
|
|
-
|
|
- this.illegalMovements = 0;
|
|
- this.legalMovements = 0;
|
|
+ if (packetplayinflying.hasPos && delta > 0.0D && this.checkMovement && !this.player.dead) {
|
|
+ for (MovementHandler handler : HylistSpigot.INSTANCE.getMovementHandlers()) {
|
|
+ try {
|
|
+ handler.handleUpdateLocation(player, to, from, packetplayinflying);
|
|
+ } catch (Exception e) {
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
+ }
|
|
|
|
- if (!player.getAllowFlight() && this.player.vehicle == null && !this.player.inWater && !BlockUtil.isOnGround(to, 0) && !BlockUtil.isOnGround(to, 1)) {
|
|
- if ((from.getX() != to.getX() || from.getZ() != to.getZ()) && to.getY() == from.getY()) {
|
|
- if (10 <= ++this.suspiciousHeightMovements) {
|
|
- final double offsetH = Math.hypot(from.getX() - to.getX(), from.getZ() - to.getZ());
|
|
- String message = String.format("%s failed Fly Check G. H %.2f. VL %s.", this.player.getName(), offsetH, this.suspiciousHeightMovements);
|
|
- Bukkit.getPluginManager().callEvent(new GuardianEvent(player, GuardianEvent.Cheat.FLY_HACKS, "G", DisplayLevel.HIGH, message, to));
|
|
- this.suspiciousHeightMovements = 0;
|
|
- }
|
|
- } else {
|
|
- this.suspiciousHeightMovements = 0;
|
|
+ if (packetplayinflying.hasLook && deltaAngle > 0.0F && this.checkMovement && !this.player.dead) {
|
|
+ for (MovementHandler handler : HylistSpigot.INSTANCE.getMovementHandlers()) {
|
|
+ try {
|
|
+ handler.handleUpdateRotation(player, to, from, packetplayinflying);
|
|
+ } catch (Exception e) {
|
|
+ e.printStackTrace();
|
|
}
|
|
- } else {
|
|
- this.suspiciousHeightMovements = 0;
|
|
}
|
|
}
|
|
- // AGC end
|
|
-
|
|
+
|
|
// Guardian start
|
|
float f4 = 0.0625F;
|
|
AxisAlignedBB axisalignedbb = this.player.boundingBox.clone().grow(f4, f4, f4).a(0.0D, -0.55D, 0.0D);
|
|
-
|
|
- boolean touchingAir = !worldserver.c(axisalignedbb);
|
|
// Guardian end
|
|
|
|
if ((delta > 1f / 256 || deltaAngle > 10f) && (this.checkMovement && !this.player.dead)) {
|
|
@@ -577,158 +350,9 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
this.lastYaw = to.getYaw();
|
|
this.lastPitch = to.getPitch();
|
|
|
|
- // Guardian start
|
|
- if (Bukkit.shouldGuardianAct()) {
|
|
- if (this.lastCalculatedHalfSecondTime + 500L < networkManager.currentTime) {
|
|
- this.lastCalculatedHalfSecondTime = networkManager.currentTime;
|
|
- this.lastHalfSecondX = to.getX();
|
|
- this.lastHalfSecondY = to.getY();
|
|
- this.lastHalfSecondZ = to.getZ();
|
|
-
|
|
- double distanceSquared = NumberConversions.square(to.getX() - from.getX()) + NumberConversions.square(to.getZ() - from.getZ());
|
|
- this.hasMovedInHalfSecond = (distanceSquared >= 0.0225D);
|
|
- }
|
|
-
|
|
- if ((!this.player.abilities.canFly) && (this.player.vehicle == null)) {
|
|
- if (this.player.onGround) {
|
|
- lastGroundY = from.getY();
|
|
- hoverPackets = 0;
|
|
- } else {
|
|
- if (worldserver.containsLiquidOrClimbable(axisalignedbb)) {
|
|
- this.lastGroundY = from.getY();
|
|
- }
|
|
-
|
|
- if ((packetplayinflying.hasPos) && (to.getY() > 0.0D) && (to.getY() == from.getY()) && (touchingAir) && (this.networkManager.lastVehicleTime + TimeUnit.SECONDS.toMillis(5) < networkManager.currentTime)) {
|
|
- this.hoverPackets++;
|
|
-
|
|
- if (this.hoverPackets >= 10) {
|
|
- String message = String.format("%s is hovering at %.1f %.1f %.1f", this.player.getName(), to.getX(), to.getY(), to.getZ());
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(getPlayer(), GuardianEvent.Cheat.HOVER, "A", GuardianEvent.DisplayLevel.HIGH, message, new Location(getPlayer().getWorld(), to.getX(), to.getY(), to.getZ()))
|
|
- );
|
|
- this.hoverPackets = 0;
|
|
- }
|
|
- } else {
|
|
- this.hoverPackets = 0;
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- if (this.lastGroundY + 1.0D < to.getY()) {
|
|
- this.killAuraTypeAViolations = 0;
|
|
- this.killAuraTypeBViolations = 0;
|
|
- }
|
|
-
|
|
- if ((!this.player.abilities.canFly) && (this.player.vehicle == null)) {
|
|
- if (this.lastGroundY != -1.0D) {
|
|
- if (this.lastHitByExplosion + TimeUnit.SECONDS.toMillis(10) < networkManager.currentTime) {
|
|
- long packetDiff = numOfTicksSinceLastPacket == 0L ? 1L : numOfTicksSinceLastPacket;
|
|
-
|
|
- double limit;
|
|
- MobEffect mobeffect = this.player.getEffect(MobEffectList.FASTER_MOVEMENT);
|
|
- int amplification = mobeffect != null ? mobeffect.getAmplifier() + 1 : 0;
|
|
-
|
|
- boolean speedIsActive = false;
|
|
- switch (amplification) {
|
|
- case 0:
|
|
- limit = 0.35D;
|
|
- break;
|
|
- case 1:
|
|
- limit = 0.39D;
|
|
- this.lastSpeedTime = networkManager.currentTime;
|
|
- speedIsActive = true;
|
|
- break;
|
|
- case 2:
|
|
- limit = 0.42D;
|
|
- this.lastSpeedTime = networkManager.currentTime;
|
|
- speedIsActive = true;
|
|
- break;
|
|
- default:
|
|
- limit = 0.35D + 0.05D * amplification;
|
|
- this.lastSpeedTime = networkManager.currentTime;
|
|
- speedIsActive = true;
|
|
- }
|
|
-
|
|
- double speed = Math.sqrt(NumberConversions.square(to.getX() - from.getX()) + NumberConversions.square(to.getZ() - from.getZ()));
|
|
- if (this.lastKeepAlivePacketReceived + 1000L > networkManager.currentTime) {
|
|
- double speedWithLag = speed / packetDiff;
|
|
- if (speedWithLag > limit) {
|
|
- if (speedWithLag >= this.lastSpeedDistance) {
|
|
- if ((!speedIsActive) && (networkManager.currentTime < this.lastSpeedTime + 2000L)) {
|
|
- } else {
|
|
- boolean isFalsePositive = false;
|
|
- double roundedFromX = Math.round(from.getX() * 10000.0D) / 10000.0D;
|
|
- double roundedFromZ = Math.round(from.getZ() * 10000.0D) / 10000.0D;
|
|
- double roundedToX = Math.round(to.getX() * 10000.0D) / 10000.0D;
|
|
- double roundedToZ = Math.round(to.getZ() * 10000.0D) / 10000.0D;
|
|
-
|
|
- if ((roundedFromX == roundedToX) || (roundedFromZ == roundedToZ)) {
|
|
- isFalsePositive = true;
|
|
- } else if ((this.lastBlockGlitchFromX == roundedFromX) || (this.lastBlockGlitchFromZ == roundedFromZ) || (this.lastBlockGlitchFromX == roundedToX) || (this.lastBlockGlitchFromZ == roundedToX)) {
|
|
- isFalsePositive = true;
|
|
- } else if ((this.lastBlockGlitchToX == roundedFromX) || (this.lastBlockGlitchToZ == roundedFromZ) || (this.lastBlockGlitchToX == roundedToX) || (this.lastBlockGlitchToZ == roundedToX)) {
|
|
- isFalsePositive = true;
|
|
- }
|
|
-
|
|
- if (!isFalsePositive) {
|
|
- this.lastBlockGlitchFromX = roundedFromX;
|
|
- this.lastBlockGlitchFromZ = roundedFromZ;
|
|
- this.lastBlockGlitchToX = roundedToX;
|
|
- this.lastBlockGlitchToZ = roundedToZ;
|
|
-
|
|
- if (++this.speedPackets >= (this.lastHit + 1500L > networkManager.currentTime ? MAX_IN_COMBAT_SPEED_PACKETS : MAX_NOT_IN_COMBAT_SPEED_PACKETS)) {
|
|
- {
|
|
- String message = this.player.getName() + " is speeding (B-Debug-1) [" + from.getX() + " " + from.getY() + " " + from.getZ() + "]";
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(getPlayer(), GuardianEvent.Cheat.DEBUG, "B-Debug-1", GuardianEvent.DisplayLevel.HIGH, message, new Location(getPlayer().getWorld(), from.getX(), from.getY(), from.getZ()))
|
|
- );
|
|
- }
|
|
-
|
|
- {
|
|
- String message = this.player.getName() + " is speeding (B-Debug-2) [" + to.getX() + " " + to.getY() + " " + to.getZ() + "]";
|
|
-
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(getPlayer(), GuardianEvent.Cheat.DEBUG, "B-Debug-2", GuardianEvent.DisplayLevel.HIGH, message, new Location(getPlayer().getWorld(), to.getX(), to.getY(), to.getZ()))
|
|
- );
|
|
- }
|
|
-
|
|
- {
|
|
- String message = this.player.getName() + " is speeding (Module B) [V:" + Math.round(speedWithLag / limit * 10.0D) / 10.0D + "]";
|
|
-
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(getPlayer(), GuardianEvent.Cheat.SPEED_HACKS, "B", GuardianEvent.DisplayLevel.HIGH, message)
|
|
- .addData("value", Math.round(speedWithLag / limit * 10.0D) / 10.0D)
|
|
- );
|
|
- }
|
|
-
|
|
- this.speedPackets = 0;
|
|
- }
|
|
- } else {
|
|
- this.speedPackets = 0;
|
|
- }
|
|
- }
|
|
- } else if (++this.speedPackets >= 3) {
|
|
- this.speedPackets = 0;
|
|
- }
|
|
- } else {
|
|
- if (++this.notHitPackets >= 3) {
|
|
- this.speedPackets = 0;
|
|
- }
|
|
- if (this.lastHit + 1500L < networkManager.currentTime) {
|
|
- this.lastHit = -1L;
|
|
- }
|
|
- }
|
|
- }
|
|
- this.lastSpeedDistance = (speed / packetDiff);
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
if (((this.isDigging) && (to.getX() != this.player.locX)) || (to.getZ() != this.player.locZ)) {
|
|
this.digHorizontalMovement += 1;
|
|
}
|
|
- // Guardian end
|
|
|
|
// Skip the first time we do this
|
|
if (true) { // Spigot - don't skip any move events
|
|
@@ -756,11 +380,7 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
return;
|
|
}
|
|
}
|
|
- } else if (lastCalculatedHalfSecondTime + 500L < networkManager.currentTime) { // Guardian start
|
|
- lastCalculatedHalfSecondTime = networkManager.currentTime;
|
|
- hasMovedInHalfSecond = false;
|
|
}
|
|
- // Guardian end
|
|
|
|
if (this.checkMovement && !this.player.dead) {
|
|
// CraftBukkit end
|
|
@@ -887,205 +507,6 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
this.player.bj();
|
|
}
|
|
|
|
- // Guardian start
|
|
-
|
|
- /*// Fly (Module G) start - Griffin
|
|
- if (!justTeleported && !this.player.abilities.canFly && this.player.vehicle == null && touchingAir && velocitiesSent.isEmpty() && (networkManager.lastVehicleTime + TimeUnit.SECONDS.toMillis(5) < networkManager.currentTime)) {
|
|
- if (nextExpectedYDelta != 0) {
|
|
- if (Math.abs(Math.abs(yDelta) - Math.abs(this.nextExpectedYDelta)) > 0.01D) {
|
|
- this.gGoodTicks = 0;
|
|
-
|
|
- if (yDelta > this.nextExpectedYDelta) {
|
|
- if (++this.flyModuleGAmount >= 5) {
|
|
- this.flyModuleGAmount = 0;
|
|
-
|
|
- String message = String.format("%s is flying (Module G) at %.1f %.1f %.1f", this.player.getName(), to.getX(), to.getY(), to.getZ());
|
|
-
|
|
- Bukkit.getPluginManager().callEvent(new GuardianEvent(
|
|
- getPlayer(), GuardianEvent.Cheat.FLY_HACKS, "G", GuardianEvent.DisplayLevel.HIGHEST, message)
|
|
- .addData("expected", this.nextExpectedYDelta)
|
|
- .addData("received", yDelta));
|
|
- }
|
|
- } else if (++this.fastFallModuleGAmount >= 5) {
|
|
- this.fastFallModuleGAmount = 0;
|
|
-
|
|
- String message = String.format("%s is falling too fast (Module G) at %.1f %.1f %.1f", this.player.getName(), to.getX(), to.getY(), to.getZ());
|
|
-
|
|
- Bukkit.getPluginManager().callEvent(new GuardianEvent(
|
|
- getPlayer(), GuardianEvent.Cheat.GENERAL, "G", GuardianEvent.DisplayLevel.HIGHEST, message)
|
|
- .addData("expected", this.nextExpectedYDelta)
|
|
- .addData("received", yDelta));
|
|
- }
|
|
-
|
|
- if (SpigotConfig.debugGuardian) debugGuardian("G: " + player.getName() + " failed: (E: " + this.nextExpectedYDelta + " | R: " + yDelta + ")");
|
|
- } else {
|
|
- if (++this.gGoodTicks >= 30) {
|
|
- this.flyModuleGAmount = 0;
|
|
- this.fastFallModuleGAmount = 0;
|
|
- this.gGoodTicks = 0;
|
|
-
|
|
- if (SpigotConfig.debugGuardian) debugGuardian("G: Reset because we got 30 good ticks.");
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- nextExpectedYDelta = (yDelta - 0.08) * 0.9800000190734863D;
|
|
-
|
|
- if (Math.abs(nextExpectedYDelta) < 0.005D) {
|
|
- this.nextExpectedYDelta = 0.0D;
|
|
- }
|
|
- } else {
|
|
- nextExpectedYDelta = 0.0D;
|
|
- }
|
|
- // Fly (Module G) end*/
|
|
-
|
|
- if ((!this.player.abilities.canFly)) {
|
|
- boolean teleport = networkManager.currentTime - this.positionSentTime < 5000L;
|
|
- double horizontalSpeed = this.horizontalSpeed;
|
|
- double blockFriction = this.blockFriction;
|
|
-
|
|
- if (onGround) {
|
|
- horizontalSpeed *= 1.3D;
|
|
- blockFriction *= 0.91D;
|
|
- horizontalSpeed *= 0.16277136D / (blockFriction * blockFriction * blockFriction);
|
|
-
|
|
- if ((Bukkit.shouldGuardianAct()) && (!packetplayinflying.i()) && (yDelta > 1.0E-4D)) {
|
|
- horizontalSpeed += 0.2D;
|
|
- MobEffect jumpBoost = this.player.getEffect(MobEffectList.JUMP);
|
|
- if ((!teleport) && (!this.player.world.c(this.player.boundingBox.grow(0.5D, 0.249D, 0.5D).d(0.0D, 0.25D, 0.0D))) && (jumpBoost == null)) {
|
|
- double kb = 0.0D;
|
|
-
|
|
- for (PacketPlayOutEntityVelocity packet : this.velocitiesSent) {
|
|
- double packetY = packet.c / 8000.0D;
|
|
- if ((packetY > 0.0D) && ((kb == 0.0D) || (packetY < kb))) {
|
|
- kb = packetY;
|
|
- }
|
|
- }
|
|
-
|
|
- if ((kb == 0.0D) && (yDelta < 0.15D)) {
|
|
- if ((this.miniJumpAmount += 20) > 70) {
|
|
- this.miniJumpAmount = 0;
|
|
- String message = String.format("%s uses Client Modifications (Module M) [%.3f] at %.1f %.1f %.1f", this.player.getName(), yDelta, d1, d2, d3);
|
|
-
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(getPlayer(), GuardianEvent.Cheat.CLIENT_MODIFICATIONS, "M", GuardianEvent.DisplayLevel.HIGH, message, new Location(getPlayer().getWorld(), d1, d2, d3))
|
|
- .addData("yDelta", yDelta)
|
|
- );
|
|
- }
|
|
- } else if (yDelta < 0.41999998688697815D) {
|
|
- if ((kb > 0.1D) && (yDelta < kb * 0.99D) && ((this.reducedKbAmount += 30) > 35)) {
|
|
- long percent = Math.round(100.0D * yDelta / kb);
|
|
- String message = String.format("%s uses Client Modifications (Module R) [%d%% %.2f/%.2f]", this.player.getName(), percent, yDelta, kb);
|
|
-
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(getPlayer(), GuardianEvent.Cheat.CLIENT_MODIFICATIONS, "R", GuardianEvent.DisplayLevel.HIGHEST, message)
|
|
- .addData("percentage", String.format("%d%%", Math.round(100.0D * yDelta / kb)))
|
|
- .addData("received/expected", String.format("%.2f/%.2f", yDelta, kb))
|
|
- );
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
- } else {
|
|
- horizontalSpeed = 0.026D;
|
|
- blockFriction = 0.91D;
|
|
- }
|
|
-
|
|
- if ((xDelta != 0.0D) || (zDelta != 0.0D)) {
|
|
- double horizontalMove = Math.sqrt(xDelta * xDelta + zDelta * zDelta);
|
|
-
|
|
- if (this.player.inWater) {
|
|
- horizontalSpeed *= 3.0D;
|
|
- }
|
|
-
|
|
- // Guardian - web hotfix (prplz)
|
|
- if (MinecraftServer.currentTick - this.player.inWebTick < 200) { // in web in last 200 ticks?
|
|
- if (this.player.world.a(this.player.boundingBox.grow(0.5, 0.5, 0.5), Material.WEB)) { // any web possibly near enough to be touching?
|
|
- horizontalSpeed *= 5.0D;
|
|
- }
|
|
- }
|
|
-
|
|
- // Guardian - piston hotfix (essentially the same as prplz' fix)
|
|
- if (MinecraftServer.currentTick - this.player.inPistonTick < 50) { // in a piston in the last 50 ticks?
|
|
- if (this.player.world.a(this.player.boundingBox.grow(1.5D, 1.5D, 1.5D), Material.PISTON)) {
|
|
- horizontalSpeed *= 5.0D;
|
|
- }
|
|
- }
|
|
-
|
|
- if ((Bukkit.shouldGuardianAct()) && (!teleport)) {
|
|
- double speedup = (horizontalMove - this.previousHorizontalMove) / horizontalSpeed;
|
|
-
|
|
- if (speedup > 1.1D) {
|
|
- double knockbackSquared = 0.0D;
|
|
-
|
|
- for (PacketPlayOutEntityVelocity packet : this.velocitiesSent) {
|
|
- double x = packet.b / 8000.0D;
|
|
- double z = packet.d / 8000.0D;
|
|
- double xz = x * x + z * z;
|
|
- if (xz > knockbackSquared) {
|
|
- knockbackSquared = xz;
|
|
- }
|
|
- }
|
|
-
|
|
- if (knockbackSquared != 0.0D) {
|
|
- horizontalSpeed += Math.sqrt(knockbackSquared);
|
|
- speedup = (horizontalMove - this.previousHorizontalMove) / horizontalSpeed;
|
|
- }
|
|
- }
|
|
-
|
|
- if (speedup > 1.1D) {
|
|
- boolean blocksNear = this.player.world.c(this.player.boundingBox.grow(1.5D, 1.5D, 1.5D));
|
|
- if (!blocksNear) {
|
|
- if (this.player.getEffect(MobEffectList.JUMP) == null && (lastJumpEffectTime + 1500L < networkManager.currentTime)) {
|
|
- if ((this.flyTypeDAmount += 20) > 90) {
|
|
- this.flyTypeDAmount = 0;
|
|
- String message = String.format("%s is flying (Module B) [%d%%] at %.1f %.1f %.1f", this.player.getName(), (int) (100.0D * speedup), d1, d2, d3);
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(getPlayer(), GuardianEvent.Cheat.FLY_HACKS, "B", GuardianEvent.DisplayLevel.HIGH, message, new Location(getPlayer().getWorld(), d1, d2, d3))
|
|
- .addData("speedup", String.format("%d%%", (int) (100.0D * speedup)))
|
|
- );
|
|
- }
|
|
- } else {
|
|
- if (this.player.getEffect(MobEffectList.JUMP) != null) lastJumpEffectTime = System.currentTimeMillis(); // don't let those people fly
|
|
- }
|
|
- } else if ((speedup > 1.5D) && ((this.speedTypeDAmount += 20) > 90)) {
|
|
-
|
|
- // should be slightly better coming from here
|
|
- if (this.player.world.boundingBoxContainsMaterials(this.player.boundingBox.grow(0.5, 1.0, 0.5), glitchBlocks)) {
|
|
- horizontalSpeed *= 5.0D;
|
|
- speedup = (horizontalMove - this.previousHorizontalMove) / horizontalSpeed;
|
|
- }
|
|
-
|
|
- // double check but I don't like doing the bounding box contain for no reason
|
|
- if (speedup > 1.5D) {
|
|
- this.speedTypeDAmount = 0;
|
|
-
|
|
- String message = String.format("%s is speeding (Module A) [%d%%] at %.1f %.1f %.1f", this.player.getName(), (int) (100.0D * speedup), d1, d2, d3);
|
|
- Bukkit.getPluginManager().callEvent(
|
|
- new GuardianEvent(getPlayer(), GuardianEvent.Cheat.SPEED_HACKS, "A", GuardianEvent.DisplayLevel.HIGH, message, new Location(getPlayer().getWorld(), d1, d2, d3))
|
|
- .addData("speedup", String.format("%d%%", (int) (100.0D * speedup)))
|
|
- );
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- this.previousHorizontalMove = (horizontalMove * blockFriction);
|
|
-
|
|
- int blockX = NumberConversions.floor(d1);
|
|
- int blockY = NumberConversions.floor(d2);
|
|
- int blockZ = NumberConversions.floor(d3);
|
|
-
|
|
- if ((blockX != this.blockFrictionX) || (blockY != this.blockFrictionY) || (blockZ != this.blockFrictionZ)) {
|
|
- this.blockFriction = this.player.world.getType(blockX, blockY - 1, blockZ).frictionFactor;
|
|
- this.blockFrictionX = blockX;
|
|
- this.blockFrictionY = blockY;
|
|
- this.blockFrictionZ = blockZ;
|
|
- }
|
|
- }
|
|
- }
|
|
- // Guardian end
|
|
-
|
|
this.player.move(xDelta, yDelta, zDelta);
|
|
this.player.onGround = packetplayinflying.i();
|
|
this.player.checkMovement(xDelta, yDelta, zDelta);
|
|
@@ -1135,27 +556,9 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
SpigotTimings.connectionTimer_PacketFlying_move.stopTiming(); // Poweruser
|
|
// Poweruser end
|
|
|
|
- // Guardian start
|
|
- if (this.flyTypeDAmount > 0) {
|
|
- this.flyTypeDAmount -= 1;
|
|
- }
|
|
-
|
|
- if (this.speedTypeDAmount > 0) {
|
|
- this.speedTypeDAmount -= 1;
|
|
- }
|
|
-
|
|
- if (this.miniJumpAmount > 0) {
|
|
- this.miniJumpAmount -= 1;
|
|
- }
|
|
-
|
|
- if (this.reducedKbAmount > 0) {
|
|
- this.reducedKbAmount -= 1;
|
|
- }
|
|
-
|
|
if (this.player.vehicle != null) {
|
|
networkManager.lastVehicleTime = networkManager.currentTime;
|
|
}
|
|
- // Guardian end
|
|
|
|
// Poweruser start
|
|
if (flag1 || (!this.player.isSleeping() && flag && !flag2) || rayTraceCollision) {
|
|
@@ -1165,25 +568,6 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
this.a(this.y, this.z, this.q, f2, f3);
|
|
}
|
|
|
|
- // Guardian start
|
|
-// if (Bukkit.shouldGuardianAct()) {
|
|
-// double dx = this.y - d1;
|
|
-// double dy = this.z - d2;
|
|
-// double dz = this.q - d3;
|
|
-//
|
|
-// if (!(dx == 0 && dz == 0)) {
|
|
-// if (Math.abs(dx) > 0.3D || Math.abs(dz) > 0.3D) {
|
|
-// String legacyMessage = String.format("%s is trying to phase (%.2f, %.2f, %.2f) at %.1f,%.1f,%.1f", this.player.getName(), dx, dy, dz, this.y, this.z, this.q);
|
|
-//
|
|
-// Bukkit.getPluginManager().callEvent(new GuardianEvent(getPlayer(), GuardianEvent.Cheat.PHASE, GuardianEvent.DisplayLevel.HIGH, "A", String.format("at %.1f,%.1f,%.1f", this.y, this.z, this.q), legacyMessage));
|
|
-// }
|
|
-// } else {
|
|
-// String legacyMessage = String.format("%s tries to VClip %.1f blocks at %.1f,%.1f,%.1f", this.player.getName(), -dy, this.y, this.z, this.q);
|
|
-//
|
|
-// Bukkit.getPluginManager().callEvent(new GuardianEvent(getPlayer(), GuardianEvent.Cheat.PHASE, GuardianEvent.DisplayLevel.HIGH, "B", String.format("%.1f blocks at %.1f,%.1f,%.1f", -dy, this.y, this.z, this.q), legacyMessage));
|
|
-// }
|
|
-// }
|
|
- // Guardian end
|
|
return;
|
|
}
|
|
// Poweruser end
|
|
@@ -1284,7 +668,6 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
this.q = d2;
|
|
this.player.setLocation(d0, d1, d2, f, f1);
|
|
this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0, d1 + 1.6200000047683716D, d2, f, f1, false));
|
|
- this.lastGroundY = -1.0D; // Guardian
|
|
}
|
|
|
|
public void a(PacketPlayInBlockDig packetplayinblockdig) {
|
|
@@ -1295,7 +678,6 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
if (!this.player.abilities.canInstantlyBuild) {
|
|
if (packetplayinblockdig.g() == 0) {
|
|
this.isDigging = true;
|
|
- this.killAuraRThreshold = 0;
|
|
this.digHorizontalMovement = 0;
|
|
} else if ((packetplayinblockdig.g() == 1) || (packetplayinblockdig.g() == 2)) {
|
|
this.isDigging = false;
|
|
@@ -1632,6 +1014,14 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
|
|
try {
|
|
this.networkManager.handle(packet, NetworkManager.emptyListenerArray); // Poweruser
|
|
+
|
|
+ for (PacketHandler handler : HylistSpigot.INSTANCE.getPacketHandlers()) {
|
|
+ try {
|
|
+ handler.handleSentPacket(this, packet);
|
|
+ } catch (Exception e) {
|
|
+ e.printStackTrace();
|
|
+ }
|
|
+ }
|
|
} catch (Throwable throwable) {
|
|
CrashReport crashreport = CrashReport.a(throwable, "Sending packet");
|
|
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent");
|
|
@@ -1660,10 +1050,6 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
}
|
|
}
|
|
|
|
- if ((this.newHorizontalSpeed != 0.0D) && (this.networkManager.currentTime - this.newHorizontalSpeedTime > latency)) {
|
|
- this.horizontalSpeed = this.newHorizontalSpeed;
|
|
- this.newHorizontalSpeed = 0.0D;
|
|
- }
|
|
}
|
|
// Guardian end
|
|
|
|
@@ -2886,36 +2272,6 @@ public class PlayerConnection implements PacketPlayInListener {
|
|
}
|
|
}
|
|
|
|
- // Guardian start
|
|
- public void updateMovementSpeed() {
|
|
- AttributeModifiable moveSpeed = (AttributeModifiable) this.player.getAttributeMap().a(GenericAttributes.d);
|
|
- double base = moveSpeed.b();
|
|
- double value = base;
|
|
-
|
|
- for (AttributeModifier modifier : (Collection<AttributeModifier>) moveSpeed.a(0)) {
|
|
- value += modifier.d();
|
|
- }
|
|
- for (AttributeModifier modifier : (Collection<AttributeModifier>) moveSpeed.a(1)) {
|
|
- value += modifier.d() * base;
|
|
- }
|
|
- for (AttributeModifier modifier : (Collection<AttributeModifier>) moveSpeed.a(2)) {
|
|
- if (modifier != EntityLiving.c) {
|
|
- value *= (1.0D + modifier.d());
|
|
- }
|
|
- }
|
|
- if (value < this.horizontalSpeed)
|
|
- {
|
|
- this.newHorizontalSpeed = value;
|
|
- this.newHorizontalSpeedTime = System.currentTimeMillis();
|
|
- }
|
|
- else
|
|
- {
|
|
- this.horizontalSpeed = value;
|
|
- this.newHorizontalSpeed = 0.0D;
|
|
- }
|
|
- }
|
|
- // Guardian end
|
|
-
|
|
public void a(EnumProtocol enumprotocol, EnumProtocol enumprotocol1) {
|
|
if (enumprotocol1 != EnumProtocol.PLAY) {
|
|
throw new IllegalStateException("Unexpected change in protocol!");
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index 47aedf89..7c648ca5 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -510,6 +510,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
packet.block = CraftMagicNumbers.getBlock(material);
|
|
packet.data = data;
|
|
+ packet.fake = true;
|
|
getHandle().playerConnection.sendPacket(packet);
|
|
}
|
|
|
|
@@ -820,7 +821,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
Validate.isTrue(amount > 0, "Amount must be greater than 0");
|
|
setStatistic(statistic, material, getStatistic(statistic, material) - amount);
|
|
}
|
|
-
|
|
+
|
|
@Override
|
|
public void setStatistic(Statistic statistic, Material material, int newValue) {
|
|
Validate.notNull(statistic, "Statistic cannot be null");
|
|
--
|
|
2.17.2 (Apple Git-113)
|
|
|