aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorprplz <[email protected]>2017-01-03 09:16:57 +1100
committerDaniel Ennis <[email protected]>2017-01-02 17:16:57 -0500
commit9b9a43e4726a9908ddd38f68a0019533f2a5e760 (patch)
tree11547d5fc34275fecece36366f73faf668197a6d
parent13ac2d8ff81969a4d76673bc00e96de874850efa (diff)
downloadPaper-9b9a43e4726a9908ddd38f68a0019533f2a5e760.tar.gz
Paper-9b9a43e4726a9908ddd38f68a0019533f2a5e760.zip
Better container checks (#564)
-rw-r--r--Spigot-Server-Patches/0201-Better-container-checks.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0201-Better-container-checks.patch b/Spigot-Server-Patches/0201-Better-container-checks.patch
new file mode 100644
index 0000000000..606290696f
--- /dev/null
+++ b/Spigot-Server-Patches/0201-Better-container-checks.patch
@@ -0,0 +1,41 @@
+From 45fbd09f4c64d743fcd64a514bc60e1fa4214be5 Mon Sep 17 00:00:00 2001
+From: Michael Himing <[email protected]>
+Date: Tue, 3 Jan 2017 08:54:00 +1100
+Subject: [PATCH] Better container checks
+
+
+diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java
+index b826089..704da18 100644
+--- a/src/main/java/net/minecraft/server/Container.java
++++ b/src/main/java/net/minecraft/server/Container.java
+@@ -461,6 +461,7 @@ public abstract class Container {
+
+ }
+
++ public boolean canPlayerUse(EntityHuman entityhuman) { return a(entityhuman); } // Paper - OBFHELPER
+ public abstract boolean a(EntityHuman entityhuman);
+
+ protected boolean a(ItemStack itemstack, int i, int j, boolean flag) {
+diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
+index e9a8428..a9857d3 100644
+--- a/src/main/java/net/minecraft/server/PlayerConnection.java
++++ b/src/main/java/net/minecraft/server/PlayerConnection.java
+@@ -1674,6 +1674,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
+ PlayerConnectionUtils.ensureMainThread(packetplayinwindowclick, this, this.player.x());
+ if (this.player.isFrozen()) return; // CraftBukkit
+ this.player.resetIdleTimer();
++ if (!this.player.activeContainer.canPlayerUse(this.player)) return; // Paper - check if player is able to use this container
+ if (this.player.activeContainer.windowId == packetplayinwindowclick.a() && this.player.activeContainer.c(this.player)) {
+ boolean cancelled = this.player.isSpectator(); // CraftBukkit - see below if
+ if (false/*this.player.isSpectator()*/) { // CraftBukkit
+@@ -2079,6 +2080,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
+ public void a(PacketPlayInTransaction packetplayintransaction) {
+ PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.x());
+ if (this.player.isFrozen()) return; // CraftBukkit
++ if (!this.player.activeContainer.canPlayerUse(this.player)) return; // Paper - check if player is able to use this container
+ Short oshort = (Short) this.k.get(this.player.activeContainer.windowId);
+
+ if (oshort != null && packetplayintransaction.b() == oshort.shortValue() && this.player.activeContainer.windowId == packetplayintransaction.a() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
+--
+2.9.2.windows.1
+