Fix for enderchests closing after being opened, go shaun!

This commit is contained in:
Shaun Bennett 2015-02-06 00:10:17 -05:00
parent 922f2d5ee9
commit 48db23c862

View File

@ -1,21 +1,25 @@
package mineplex.core.treasure.animation;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction;
import net.minecraft.server.v1_7_R4.TileEntity;
import net.minecraft.server.v1_7_R4.TileEntityEnderChest;
import mineplex.core.common.util.UtilServer;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager;
import mineplex.core.reward.RewardData;
import mineplex.core.treasure.ChestData;
import mineplex.core.treasure.Treasure;
import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
/**
* Created by Shaun on 8/29/2014.
@ -43,6 +47,15 @@ public class ChestOpenAnimation extends Animation
for (Player other : UtilServer.getPlayers())
{
((CraftPlayer) other).getHandle().playerConnection.sendPacket(packet);
if (block.getType() == Material.ENDER_CHEST)
{
// Fix for Ender Chests closing as soon as they are opened
TileEntity tileEntity = ((CraftWorld) block.getWorld()).getTileEntityAt(block.getX(), block.getY(), block.getZ());
if (tileEntity instanceof TileEntityEnderChest)
((TileEntityEnderChest)tileEntity).j = 1;
}
other.playSound(block.getLocation(), Sound.CHEST_OPEN, 1, 1);
}
}