13
0
geforkt von Mirrors/Paper

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.
Dieser Commit ist enthalten in:
bloodshot 2014-01-06 16:29:51 -05:00 committet von Travis Watkins
Ursprung d0be633ed9
Commit 5c115116ef

Datei anzeigen

@ -576,7 +576,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void startCrafting(int i, int j, int k) { public void startCrafting(int i, int j, int k) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.world, i, j, k)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.world, i, j, k));
if(container == null) return; if (container == null) {
return;
}
// CraftBukkit end // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -589,7 +591,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void startEnchanting(int i, int j, int k, String s) { public void startEnchanting(int i, int j, int k, String s) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantTable(this.inventory, this.world, i, j, k)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantTable(this.inventory, this.world, i, j, k));
if(container == null) return; if (container == null) {
return;
}
// CraftBukkit end // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -602,7 +606,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openAnvil(int i, int j, int k) { public void openAnvil(int i, int j, int k) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerAnvil(this.inventory, this.world, i, j, k, this)); 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 // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -619,7 +625,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory)); 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 // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -632,7 +641,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openHopper(TileEntityHopper tileentityhopper) { public void openHopper(TileEntityHopper tileentityhopper) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, tileentityhopper)); 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 // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -645,7 +657,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openMinecartHopper(EntityMinecartHopper entityminecarthopper) { public void openMinecartHopper(EntityMinecartHopper entityminecarthopper) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, entityminecarthopper)); 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 // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -658,7 +673,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openFurnace(TileEntityFurnace tileentityfurnace) { public void openFurnace(TileEntityFurnace tileentityfurnace) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerFurnace(this.inventory, tileentityfurnace)); 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 // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -671,7 +689,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openDispenser(TileEntityDispenser tileentitydispenser) { public void openDispenser(TileEntityDispenser tileentitydispenser) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerDispenser(this.inventory, tileentitydispenser)); 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 // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -684,7 +705,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) { public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBrewingStand(this.inventory, tileentitybrewingstand)); 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 // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -697,7 +721,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openBeacon(TileEntityBeacon tileentitybeacon) { public void openBeacon(TileEntityBeacon tileentitybeacon) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBeacon(this.inventory, tileentitybeacon)); 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 // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -710,7 +737,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openTrade(IMerchant imerchant, String s) { public void openTrade(IMerchant imerchant, String s) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, imerchant, this.world)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, imerchant, this.world));
if(container == null) return; if (container == null) {
return;
}
// CraftBukkit end // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -740,7 +769,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openHorseInventory(EntityHorse entityhorse, IInventory iinventory) { public void openHorseInventory(EntityHorse entityhorse, IInventory iinventory) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHorse(this.inventory, iinventory, entityhorse)); 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 // CraftBukkit end
if (this.activeContainer != this.defaultContainer) { if (this.activeContainer != this.defaultContainer) {