From bce99d4a945af6226ac848d920eccc10e0d1fcd8 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 2 May 2020 13:32:03 -0400 Subject: [PATCH] Fix being kicked in survival for block picking - Fixes #3277 --- Spigot-API-Patches/Expose-game-version.patch | 4 ++-- Spigot-Server-Patches/Expose-game-version.patch | 2 +- .../Validate-PickItem-Packet-and-kick-for-invalid.patch | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Spigot-API-Patches/Expose-game-version.patch b/Spigot-API-Patches/Expose-game-version.patch index e5a3a523af..49b563daa4 100644 --- a/Spigot-API-Patches/Expose-game-version.patch +++ b/Spigot-API-Patches/Expose-game-version.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expose game version diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index b9973406..d4af3a1d 100644 +index ea3e5d6fa..95ad01226 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -0,0 +0,0 @@ public final class Bukkit { @@ -28,7 +28,7 @@ index b9973406..d4af3a1d 100644 * Gets a view of all currently logged in players. This {@linkplain * Collections#unmodifiableCollection(Collection) view} is a reused diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 80f9abdc..08817f02 100644 +index 9ceaac0e8..c3fb1c271 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { diff --git a/Spigot-Server-Patches/Expose-game-version.patch b/Spigot-Server-Patches/Expose-game-version.patch index 957a996b6d..a8b9950ac6 100644 --- a/Spigot-Server-Patches/Expose-game-version.patch +++ b/Spigot-Server-Patches/Expose-game-version.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expose game version diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b9a398bc5..5bd6f2a88 100644 +index f49193d9d7..1647c09756 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { diff --git a/Spigot-Server-Patches/Validate-PickItem-Packet-and-kick-for-invalid.patch b/Spigot-Server-Patches/Validate-PickItem-Packet-and-kick-for-invalid.patch index dffcb96a92..a39de00865 100644 --- a/Spigot-Server-Patches/Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/Spigot-Server-Patches/Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -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;