summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorbloodshot <jdroque@gmail.com>2014-01-06 16:29:51 -0500
committerTravis Watkins <amaranth@ubuntu.com>2014-04-18 12:47:32 -0500
commit5c115116ef25eadb3a5e54b4d093c2c940c7857f (patch)
tree4002ecb8d724d8003fd45ee20dd8e580d4778c1d /src/main
parentd0be633ed97707435e5c397efb4e4f6b2c8e21a0 (diff)
downloadcraftbukkit-5c115116ef25eadb3a5e54b4d093c2c940c7857f.tar
craftbukkit-5c115116ef25eadb3a5e54b4d093c2c940c7857f.tar.gz
craftbukkit-5c115116ef25eadb3a5e54b4d093c2c940c7857f.tar.lz
craftbukkit-5c115116ef25eadb3a5e54b4d093c2c940c7857f.tar.xz
craftbukkit-5c115116ef25eadb3a5e54b4d093c2c940c7857f.zip
Update chest animation after cancelling open event. Fixes BUKKIT-1440
Currently if a plugin cancels an InventoryOpenEvent for vanilla chests, the chest animation for clients is stuck in the open state since IInventory's closeContainer method is never called. To fix the issue, closeContainer is called before exiting the display GUI method.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/net/minecraft/server/EntityPlayer.java56
1 files changed, 44 insertions, 12 deletions
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 9b80aef5..b5ebce6b 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -576,7 +576,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void startCrafting(int i, int j, int k) {
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.world, i, j, k));
- if(container == null) return;
+ if (container == null) {
+ return;
+ }
// CraftBukkit end
this.nextContainerCounter();
@@ -589,7 +591,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void startEnchanting(int i, int j, int k, String s) {
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantTable(this.inventory, this.world, i, j, k));
- if(container == null) return;
+ if (container == null) {
+ return;
+ }
// CraftBukkit end
this.nextContainerCounter();
@@ -602,7 +606,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openAnvil(int i, int j, int k) {
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerAnvil(this.inventory, this.world, i, j, k, this));
- if(container == null) return;
+ if (container == null) {
+ return;
+ }
// CraftBukkit end
this.nextContainerCounter();
@@ -619,7 +625,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory));
- if(container == null) return;
+ if (container == null) {
+ iinventory.l_(); // Should be closeContainer
+ return;
+ }
// CraftBukkit end
this.nextContainerCounter();
@@ -632,7 +641,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openHopper(TileEntityHopper tileentityhopper) {
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, tileentityhopper));
- if(container == null) return;
+ if (container == null) {
+ tileentityhopper.l_(); // Should be closeContainer
+ return;
+ }
// CraftBukkit end
this.nextContainerCounter();
@@ -645,7 +657,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openMinecartHopper(EntityMinecartHopper entityminecarthopper) {
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, entityminecarthopper));
- if(container == null) return;
+ if (container == null) {
+ entityminecarthopper.l_(); // Should be closeContainer
+ return;
+ }
// CraftBukkit end
this.nextContainerCounter();
@@ -658,7 +673,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openFurnace(TileEntityFurnace tileentityfurnace) {
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerFurnace(this.inventory, tileentityfurnace));
- if(container == null) return;
+ if (container == null) {
+ tileentityfurnace.l_(); // Should be closeContainer
+ return;
+ }
// CraftBukkit end
this.nextContainerCounter();
@@ -671,7 +689,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openDispenser(TileEntityDispenser tileentitydispenser) {
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerDispenser(this.inventory, tileentitydispenser));
- if(container == null) return;
+ if (container == null) {
+ tileentitydispenser.l_(); // Should be closeContainer
+ return;
+ }
// CraftBukkit end
this.nextContainerCounter();
@@ -684,7 +705,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) {
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBrewingStand(this.inventory, tileentitybrewingstand));
- if(container == null) return;
+ if (container == null) {
+ tileentitybrewingstand.l_(); // Should be closeContainer
+ return;
+ }
// CraftBukkit end
this.nextContainerCounter();
@@ -697,7 +721,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openBeacon(TileEntityBeacon tileentitybeacon) {
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBeacon(this.inventory, tileentitybeacon));
- if(container == null) return;
+ if (container == null) {
+ tileentitybeacon.l_(); // Should be closeContainer
+ return;
+ }
// CraftBukkit end
this.nextContainerCounter();
@@ -710,7 +737,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openTrade(IMerchant imerchant, String s) {
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, imerchant, this.world));
- if(container == null) return;
+ if (container == null) {
+ return;
+ }
// CraftBukkit end
this.nextContainerCounter();
@@ -740,7 +769,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openHorseInventory(EntityHorse entityhorse, IInventory iinventory) {
// CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHorse(this.inventory, iinventory, entityhorse));
- if(container == null) return;
+ if (container == null) {
+ iinventory.l_(); // Should be closeContainer
+ return;
+ }
// CraftBukkit end
if (this.activeContainer != this.defaultContainer) {