Fix being kicked in survival for block picking - Fixes #3277
This commit is contained in:
@@ -5,7 +5,7 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 38ec22f4c0..60c3af4d64 100644
|
||||
index 38ec22f4c0..2d83db9b22 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
@@ -14,7 +14,7 @@ index 38ec22f4c0..60c3af4d64 100644
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinpickitem, this, this.player.getWorldServer());
|
||||
- this.player.inventory.c(packetplayinpickitem.b());
|
||||
+ // Paper start - validate pick item position
|
||||
+ if (!(packetplayinpickitem.b() >= 0 && packetplayinpickitem.b() < PlayerInventory.getHotbarSize())) {
|
||||
+ if (!(packetplayinpickitem.b() >= 0 && packetplayinpickitem.b() < this.player.inventory.items.size())) {
|
||||
+ PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getDisplayName().getString());
|
||||
+ this.disconnect("Invalid hotbar selection (Hacking?)");
|
||||
+ return;
|
||||
|
||||
Reference in New Issue
Block a user