2018-01-18 07:00:51 +01:00
|
|
|
From d515cb2947636628e6f0f272a72a73fc0d03b5c5 Mon Sep 17 00:00:00 2001
|
2016-12-22 03:22:02 +01:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Thu, 23 Jun 2016 23:33:57 -0400
|
|
|
|
Subject: [PATCH] IllegalPacketEvent
|
|
|
|
|
|
|
|
Fired for invalid data from players that represents hacking attempts
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2018-01-18 07:00:51 +01:00
|
|
|
index 0191a9af2..45a50602b 100644
|
2016-12-22 03:22:02 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
|
|
@@ -56,6 +56,7 @@ import org.bukkit.inventory.CraftingInventory;
|
|
|
|
import org.bukkit.inventory.EquipmentSlot;
|
|
|
|
import org.bukkit.inventory.InventoryView;
|
|
|
|
import org.bukkit.util.NumberConversions;
|
|
|
|
+import com.destroystokyo.paper.event.player.IllegalPacketEvent; // Paper
|
|
|
|
import co.aikar.timings.MinecraftTimings; // Paper
|
|
|
|
// CraftBukkit end
|
|
|
|
|
2017-11-08 17:13:57 +01:00
|
|
|
@@ -2288,8 +2289,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
2016-12-22 03:22:02 +01:00
|
|
|
CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit
|
|
|
|
}
|
|
|
|
} catch (Exception exception) {
|
|
|
|
- PlayerConnection.LOGGER.error("Couldn\'t handle book info", exception);
|
|
|
|
- this.disconnect("Invalid book data!"); // CraftBukkit
|
|
|
|
+ IllegalPacketEvent.process(player.getBukkitEntity(), "InvalidBookEdit", "Invalid book data!", exception); // Paper
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
String s1;
|
2017-11-08 17:13:57 +01:00
|
|
|
@@ -2338,8 +2338,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
2016-12-22 03:22:02 +01:00
|
|
|
CraftEventFactory.handleEditBookEvent(player, itemstack2); // CraftBukkit
|
|
|
|
}
|
|
|
|
} catch (Exception exception1) {
|
|
|
|
- PlayerConnection.LOGGER.error("Couldn\'t sign book", exception1);
|
|
|
|
- this.disconnect("Invalid book data!"); // CraftBukkit
|
|
|
|
+ IllegalPacketEvent.process(player.getBukkitEntity(), "InvalidBookSign", "Invalid book data!", exception1); // Paper
|
|
|
|
}
|
|
|
|
} else if ("MC|TrSel".equals(s)) {
|
|
|
|
try {
|
2017-11-08 17:13:57 +01:00
|
|
|
@@ -2350,8 +2349,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
2016-12-22 03:22:02 +01:00
|
|
|
((ContainerMerchant) container).d(j);
|
|
|
|
}
|
|
|
|
} catch (Exception exception2) {
|
|
|
|
- PlayerConnection.LOGGER.error("Couldn\'t select trade", exception2);
|
|
|
|
- this.disconnect("Invalid trade data!"); // CraftBukkit
|
|
|
|
+ IllegalPacketEvent.process(player.getBukkitEntity(), "InvalidTrade", "Invalid trade data!", exception2); // Paper
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
TileEntity tileentity;
|
2017-11-08 17:13:57 +01:00
|
|
|
@@ -2492,8 +2490,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
2016-12-22 03:22:02 +01:00
|
|
|
iinventory.update();
|
|
|
|
}
|
|
|
|
} catch (Exception exception5) {
|
|
|
|
- PlayerConnection.LOGGER.error("Couldn\'t set beacon", exception5);
|
|
|
|
- this.disconnect("Invalid beacon data!"); // CraftBukkit
|
|
|
|
+ IllegalPacketEvent.process(player.getBukkitEntity(), "InvalidBeacon", "Invalid beacon data!", exception5); // Paper
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if ("MC|ItemName".equals(s)) {
|
2017-11-08 17:13:57 +01:00
|
|
|
@@ -2592,8 +2589,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
2016-12-22 03:22:02 +01:00
|
|
|
this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(-2, k, this.player.inventory.getItem(k)));
|
|
|
|
this.player.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex));
|
|
|
|
} catch (Exception exception7) {
|
|
|
|
- PlayerConnection.LOGGER.error("Couldn\'t pick item", exception7);
|
2017-05-14 03:37:46 +02:00
|
|
|
- this.disconnect("Invalid pick item!"); // CraftBukkit
|
2016-12-22 03:22:02 +01:00
|
|
|
+ IllegalPacketEvent.process(player.getBukkitEntity(), "InvalidPickItem", "Invalid PickItem", exception7); // Paper
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// CraftBukkit start
|
|
|
|
--
|
2018-01-18 07:00:51 +01:00
|
|
|
2.16.1
|
2016-12-22 03:22:02 +01:00
|
|
|
|