PaperMC/Spigot-Server-Patches/0476-Prevent-opening-inventories-when-frozen.patch
2020-04-13 07:33:46 +01:00

34 lines
1.6 KiB
Diff

From a21d662887b49264ae30102a1bffdd2a9295b68d Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Mon, 13 Apr 2020 07:31:44 +0100
Subject: [PATCH] Prevent opening inventories when frozen
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index fb3897583..cd8df622f 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -1917,7 +1917,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
@Override
- protected boolean isFrozen() {
+ public boolean isFrozen() { // Paper - protected > public
return super.isFrozen() || (this.playerConnection != null && this.playerConnection.isDisconnected()); // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 1c88eacea..5a79c7f13 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -305,6 +305,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
public InventoryView openInventory(Inventory inventory) {
if (!(getHandle() instanceof EntityPlayer)) return null;
EntityPlayer player = (EntityPlayer) getHandle();
+ if (player.isFrozen()) return null; // Paper
Container formerContainer = getHandle().activeContainer;
ITileInventory iinventory = null;
--
2.26.0