Compare commits

..

2 Commits

Author SHA1 Message Date
Jikoo
fcc9a4c0cb Almost entirely functional silent shulker boxes
For whatever reason, the shulker box EnumDirection isn't being retrieved properly, so AnyChest will only trigger on shulker boxes that would not be able to open if placed downwards (opening upwards). Silentchest and anychest will work, though.
Suppressed a few deprecation warnings that don't make sense to keep.
If you do use my fork of OpenInv's API, it's not yet stable (specifically, IAnySilentContainer), and will change a little more as I polish things up.
2016-11-23 21:57:05 -05:00
Jikoo
454467c20e Fix SPIGOT-2806 for silent chests, various other issues
* Fixed anychest message spam
* Changed AnySilentContainer again to reduce duplicate checks
 * #isAnyContainerNeeded should be checked before calling #activateContainer
 * reorganized ifs for doublechest creation into reverse-order if elses to prevent creating extras when someone's broken Minecraft and put 3+ adjacent to each other
* Fixed incorrect block being checked for anychest in 1.11
* Progress on SilentContainerShulkerBox (we're getting there!)

anychest and silentchest aren't quite at 100% after all these changes, but it won't be a priority to revisit logic until shulker boxes are done
2016-11-22 03:30:34 -05:00
47 changed files with 458 additions and 394 deletions

View File

@@ -9,7 +9,7 @@
<artifactId>openinv</artifactId> <artifactId>openinv</artifactId>
<name>OpenInv</name> <name>OpenInv</name>
<version>2.5.3-SNAPSHOT</version> <version>2.5.4</version>
<profiles> <profiles>

View File

@@ -25,7 +25,7 @@ import org.bukkit.entity.Player;
public interface IAnySilentChest { public interface IAnySilentChest {
/** /**
* @deprecated Use {@link IAnySilentContainer#activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link IAnySilentContainer#activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z); public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z);

View File

@@ -1,8 +1,9 @@
package com.lishid.openinv.internal; package com.lishid.openinv.internal;
import org.bukkit.block.BlockState; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@SuppressWarnings("deprecation")
public interface IAnySilentContainer extends IAnySilentChest { public interface IAnySilentContainer extends IAnySilentChest {
/** /**
@@ -11,20 +12,21 @@ public interface IAnySilentContainer extends IAnySilentChest {
* @param block the BlockState * @param block the BlockState
* @return true if the Block is a supported container * @return true if the Block is a supported container
*/ */
public boolean isAnySilentContainer(BlockState block); public boolean isAnySilentContainer(Block block);
/** /**
* Opens the container at the given coordinates for the Player. * Opens the container at the given coordinates for the Player. If you do not want blocked
* containers to open, be sure to check {@link #isAnyContainerNeeded(Player, int, int, int)}
* first.
* *
* @param player * @param player
* @param anychest whether compatibility for blocked containers is to be used
* @param silentchest whether the container's noise is to be silenced * @param silentchest whether the container's noise is to be silenced
* @param x the x coordinate * @param x the x coordinate
* @param y the y coordinate * @param y the y coordinate
* @param z the z coordinate * @param z the z coordinate
* @return true if the container can be opened * @return true if the container can be opened
*/ */
public boolean activateContainer(Player player, boolean anychest, boolean silentchest, int x, int y, int z); public boolean activateContainer(Player player, boolean silentchest, int x, int y, int z);
/** /**
* Checks if the container at the given coordinates is blocked. * Checks if the container at the given coordinates is blocked.

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_10_R1;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// Volatile // Volatile
@@ -41,32 +41,31 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(new BlockPosition(x, y, z)); Object chest = world.getTileEntity(new BlockPosition(x, y, z));
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock()); int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock());
if (Block.getId(world.getType(new BlockPosition(x - 1, y, z)).getBlock()) == id) if (Block.getId(world.getType(new BlockPosition(x, y, z + 1)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x - 1, y, z)), (ITileInventory) chest);
if (Block.getId(world.getType(new BlockPosition(x + 1, y, z)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x + 1, y, z)));
if (Block.getId(world.getType(new BlockPosition(x, y, z - 1)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z - 1)), (ITileInventory) chest);
if (Block.getId(world.getType(new BlockPosition(x, y, z + 1)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z + 1))); chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z + 1)));
} else if (Block.getId(world.getType(new BlockPosition(x, y, z - 1)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z - 1)), (ITileInventory) chest);
} else if (Block.getId(world.getType(new BlockPosition(x + 1, y, z)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x + 1, y, z)));
} else if (Block.getId(world.getType(new BlockPosition(x - 1, y, z)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x - 1, y, z)), (ITileInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -97,8 +96,9 @@ public class AnySilentContainer implements IAnySilentContainer {
World world = player.world; World world = player.world;
// If block or ocelot on top // If block or ocelot on top
if (world.getType(new BlockPosition(x, y + 1, z)).l() || hasOcelotOnTop(world, x, y, z)) if (world.getType(new BlockPosition(x, y + 1, z)).l() || hasOcelotOnTop(world, x, y, z)) {
return true; return true;
}
int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock()); int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock());
@@ -133,12 +133,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -31,10 +31,11 @@ import net.minecraft.server.v1_10_R1.IInventory;
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftInventory; import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftInventory;
public class InventoryAccess implements IInventoryAccess { public class InventoryAccess implements IInventoryAccess {
@Override @Override
public boolean check(Inventory inventory, HumanEntity player) { public boolean check(Inventory inventory, HumanEntity player) {
IInventory inv = grabInventory(inventory); IInventory inv = grabInventory(inventory);
if (inv instanceof SpecialPlayerInventory) { if (inv instanceof SpecialPlayerInventory) {
if (!OpenInv.hasPermission(player, Permissions.PERM_EDITINV)) { if (!OpenInv.hasPermission(player, Permissions.PERM_EDITINV)) {
return false; return false;
@@ -51,24 +52,24 @@ public class InventoryAccess implements IInventoryAccess {
} }
private IInventory grabInventory(Inventory inventory) { private IInventory grabInventory(Inventory inventory) {
if(inventory instanceof CraftInventory) { if (inventory instanceof CraftInventory) {
return ((CraftInventory) inventory).getInventory(); return ((CraftInventory) inventory).getInventory();
} }
//Use reflection to find the iinventory // Use reflection to find the iinventory
Class<? extends Inventory> clazz = inventory.getClass(); Class<? extends Inventory> clazz = inventory.getClass();
IInventory result = null; IInventory result = null;
for(Field f : clazz.getDeclaredFields()) { for (Field f : clazz.getDeclaredFields()) {
f.setAccessible(true); f.setAccessible(true);
if(IInventory.class.isAssignableFrom(f.getDeclaringClass())) { if (IInventory.class.isAssignableFrom(f.getDeclaringClass())) {
try { try {
result = (IInventory) f.get(inventory); result = (IInventory) f.get(inventory);
} } catch (Exception e) {
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
return result; return result;
} }
} }

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_10_R1;
import net.minecraft.server.v1_10_R1.ContainerChest; import net.minecraft.server.v1_10_R1.ContainerChest;
import net.minecraft.server.v1_10_R1.EntityHuman; import net.minecraft.server.v1_10_R1.EntityHuman;
import net.minecraft.server.v1_10_R1.IInventory; import net.minecraft.server.v1_10_R1.IInventory;
import net.minecraft.server.v1_10_R1.ItemStack;
import net.minecraft.server.v1_10_R1.PlayerInventory; import net.minecraft.server.v1_10_R1.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried(), false); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried, false);
} }
} }
} }

View File

@@ -18,14 +18,19 @@ package com.lishid.openinv.internal.v1_11_R1;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
// Volatile // Volatile
import net.minecraft.server.v1_11_R1.AxisAlignedBB; import net.minecraft.server.v1_11_R1.AxisAlignedBB;
import net.minecraft.server.v1_11_R1.Block; import net.minecraft.server.v1_11_R1.Block;
import net.minecraft.server.v1_11_R1.BlockChest; import net.minecraft.server.v1_11_R1.BlockChest;
import net.minecraft.server.v1_11_R1.BlockChest.Type; import net.minecraft.server.v1_11_R1.BlockChest.Type;
import net.minecraft.server.v1_11_R1.BlockEnderChest;
import net.minecraft.server.v1_11_R1.BlockPosition; import net.minecraft.server.v1_11_R1.BlockPosition;
import net.minecraft.server.v1_11_R1.BlockShulkerBox; import net.minecraft.server.v1_11_R1.BlockShulkerBox;
import net.minecraft.server.v1_11_R1.Container; import net.minecraft.server.v1_11_R1.Container;
@@ -49,23 +54,33 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(org.bukkit.block.BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest || block instanceof org.bukkit.block.ShulkerBox; if (block.getType() == Material.ENDER_CHEST) {
return true;
}
BlockState state = block.getState();
return state instanceof org.bukkit.block.Chest || state instanceof org.bukkit.block.ShulkerBox;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
// TODO backport to all modules? TODO change new API to activateContainer(Player, Block)? Use BlockState instead?
if (silentchest && p.getWorld().getBlockAt(x, y, z).getType() == Material.ENDER_CHEST) {
p.openInventory(p.getEnderChest());
return true;
}
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; final World world = player.world;
BlockPosition blockPosition = new BlockPosition(x, y, z); final BlockPosition blockPosition = new BlockPosition(x, y, z);
Object tile = world.getTileEntity(blockPosition); Object tile = world.getTileEntity(blockPosition);
if (tile == null) { if (tile == null) {
return false; return false;
} }
Block block = world.getType(new BlockPosition(x, y, z)).getBlock(); Block block = world.getType(blockPosition).getBlock();
Container container = null; Container container = null;
if (block instanceof BlockChest) { if (block instanceof BlockChest) {
@@ -79,10 +94,6 @@ public class AnySilentContainer implements IAnySilentContainer {
continue; continue;
} }
if (!anychest && isBlockedChest(world, localBlock, localBlockPosition)) {
return false;
}
TileEntity localTileEntity = world.getTileEntity(localBlockPosition); TileEntity localTileEntity = world.getTileEntity(localBlockPosition);
if (!(localTileEntity instanceof TileEntityChest)) { if (!(localTileEntity instanceof TileEntityChest)) {
continue; continue;
@@ -110,40 +121,59 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
if (block instanceof BlockShulkerBox) { if (block instanceof BlockShulkerBox) {
if (!anychest && isBlockedShulkerBox(world, blockPosition, block)) {
return false;
}
player.b(StatisticList.ae); player.b(StatisticList.ae);
if (silentchest && tile instanceof TileEntityShulkerBox) { if (silentchest && tile instanceof TileEntityShulkerBox) {
// TODO: This fixes sound, but the box is then silent for anyone until the tile entity is recreated // Set value to current + 1. Ensures consistency later when resetting.
SilentContainerShulkerBox.increaseOpenQuantity((TileEntityShulkerBox) tile); SilentContainerShulkerBox.setOpenValue((TileEntityShulkerBox) tile,
container = new SilentContainerShulkerBox(player.inventory, ((IInventory) tile), player); SilentContainerShulkerBox.getOpenValue((TileEntityShulkerBox) tile) + 1);
SilentContainerShulkerBox.decreaseOpenQuantity((TileEntityShulkerBox) tile);
container = new SilentContainerShulkerBox(player.inventory, (IInventory) tile, player);
} }
} }
if (!(tile instanceof IInventory)) {
// TODO anyenderchest
p.sendMessage(ChatColor.RED + "Unhandled non-IInventory for block!");
return false;
}
boolean returnValue = false; boolean returnValue = false;
final IInventory iInventory = (IInventory) tile;
if (!silentchest || container == null) { if (!silentchest || container == null) {
player.openContainer((IInventory) tile); player.openContainer(iInventory);
returnValue = true; returnValue = true;
} else { } else {
try { try {
int windowId = player.nextContainerCounter(); int windowId = player.nextContainerCounter();
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, "minecraft:chest", ((IInventory) tile).getScoreboardDisplayName(), ((IInventory) tile).getSize())); player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, iInventory.getName(), iInventory.getScoreboardDisplayName(), iInventory.getSize()));
player.activeContainer = container; player.activeContainer = container;
player.activeContainer.windowId = windowId; player.activeContainer.windowId = windowId;
player.activeContainer.addSlotListener(player); player.activeContainer.addSlotListener(player);
returnValue = true; returnValue = true;
if (tile instanceof TileEntityShulkerBox) {
new BukkitRunnable() {
@Override
public void run() {
// TODO hacky
Object tile = world.getTileEntity(blockPosition);
if (!(tile instanceof TileEntityShulkerBox)) {
return;
}
TileEntityShulkerBox box = (TileEntityShulkerBox) tile;
// Reset back - we added 1, and calling TileEntityShulkerBox#startOpen adds 1 more.
SilentContainerShulkerBox.setOpenValue(box,
SilentContainerShulkerBox.getOpenValue((TileEntityShulkerBox) tile) - 2);
}
}.runTaskLater(Bukkit.getPluginManager().getPlugin("OpenInv"), 2);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
p.sendMessage(ChatColor.RED + "Error while sending silent chest."); p.sendMessage(ChatColor.RED + "Error while sending silent chest.");
} }
} }
return returnValue; return returnValue;
} }
@@ -158,16 +188,31 @@ public class AnySilentContainer implements IAnySilentContainer {
return isBlockedShulkerBox(world, blockPosition, block); return isBlockedShulkerBox(world, blockPosition, block);
} }
// For reference, loot at net.minecraft.server.BlockChest if (block instanceof BlockEnderChest) {
// Ender chests are not blocked by ocelots.
return world.getType(new BlockPosition(x, y + 1, z)).m();
}
// Check if chest is blocked or has an ocelot on top // Check if chest is blocked or has an ocelot on top
if (world.getType(new BlockPosition(x, y + 1, z)).m() || hasOcelotOnTop(world, blockPosition)) { if (isBlockedChest(world, blockPosition)) {
return true; return true;
} }
// Check for matching adjacent chests that are blocked or have an ocelot on top // Check for matching adjacent chests that are blocked or have an ocelot on top
for (EnumDirection localEnumDirection : EnumDirection.EnumDirectionLimit.HORIZONTAL) { for (EnumDirection localEnumDirection : EnumDirection.EnumDirectionLimit.HORIZONTAL) {
BlockPosition localBlockPosition = blockPosition.shift(localEnumDirection); BlockPosition localBlockPosition = blockPosition.shift(localEnumDirection);
if (isBlockedChest(world, block, localBlockPosition)) { Block localBlock = world.getType(localBlockPosition).getBlock();
if (localBlock != block) {
continue;
}
TileEntity localTileEntity = world.getTileEntity(localBlockPosition);
if (!(localTileEntity instanceof TileEntityChest)) {
continue;
}
if (isBlockedChest(world, localBlockPosition)) {
return true; return true;
} }
} }
@@ -192,18 +237,15 @@ public class AnySilentContainer implements IAnySilentContainer {
.a(enumDirection.getAdjacentX(), enumDirection.getAdjacentY(), .a(enumDirection.getAdjacentX(), enumDirection.getAdjacentY(),
enumDirection.getAdjacentZ()); enumDirection.getAdjacentZ());
return !(world.b(axisAlignedBB.a(blockPosition.shift(enumDirection)))); return world.b(axisAlignedBB.a(blockPosition.shift(enumDirection)));
} }
return true; return false;
} }
private boolean isBlockedChest(World world, Block block, BlockPosition blockPosition) { private boolean isBlockedChest(World world, BlockPosition blockPosition) {
if (world.getType(blockPosition).getBlock() == block) { // For reference, loot at net.minecraft.server.BlockChest
return false; return world.getType(blockPosition.up()).m() || hasOcelotOnTop(world, blockPosition);
}
return world.getType(blockPosition).m() || hasOcelotOnTop(world, blockPosition);
} }
private boolean hasOcelotOnTop(World world, BlockPosition blockPosition) { private boolean hasOcelotOnTop(World world, BlockPosition blockPosition) {
@@ -226,7 +268,7 @@ public class AnySilentContainer implements IAnySilentContainer {
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -37,9 +37,10 @@ public class SilentContainerChest extends ContainerChest {
// Don't send close signal twice, might screw up // Don't send close signal twice, might screw up
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (!playerinventory.getCarried().isEmpty()) { if (playerinventory.getCarried() != ItemStack.a) {
entityHuman.drop(playerinventory.getCarried(), false); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(ItemStack.a); playerinventory.setCarried(ItemStack.a);
entityHuman.drop(carried, false);
} }
} }
} }

View File

@@ -21,19 +21,20 @@ public class SilentContainerShulkerBox extends ContainerShulkerBox {
return h; return h;
} }
public static void increaseOpenQuantity(TileEntityShulkerBox containerShulkerBox) { public static void setOpenValue(TileEntityShulkerBox tileShulkerBox, Object value) {
try { try {
exposeOpenStatus().set(containerShulkerBox, ((Integer) exposeOpenStatus().get(containerShulkerBox)) + 1); exposeOpenStatus().set(tileShulkerBox, value);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public static void decreaseOpenQuantity(TileEntityShulkerBox containerShulkerBox) { public static Integer getOpenValue(TileEntityShulkerBox tileShulkerBox) {
try { try {
exposeOpenStatus().set(containerShulkerBox, ((Integer) exposeOpenStatus().get(containerShulkerBox)) - 1); return (Integer) exposeOpenStatus().get(tileShulkerBox);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return 0;
} }
} }

View File

@@ -21,7 +21,7 @@ import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// Volatile // Volatile
@@ -40,30 +40,29 @@ import org.bukkit.craftbukkit.v1_4_5.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(x, y, z); Object chest = world.getTileEntity(x, y, z);
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
if (world.getTypeId(x - 1, y, z) == Block.CHEST.id) if (world.getTypeId(x, y, z + 1) == Block.CHEST.id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
if (world.getTypeId(x + 1, y, z) == Block.CHEST.id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
if (world.getTypeId(x, y, z - 1) == Block.CHEST.id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
if (world.getTypeId(x, y, z + 1) == Block.CHEST.id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1)); chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1));
} else if(world.getTypeId(x, y, z - 1) == Block.CHEST.id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
} else if (world.getTypeId(x + 1, y, z) == Block.CHEST.id) {
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
} else if (world.getTypeId(x - 1, y, z) == Block.CHEST.id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -134,12 +133,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_4_5;
import net.minecraft.server.v1_4_5.ContainerChest; import net.minecraft.server.v1_4_5.ContainerChest;
import net.minecraft.server.v1_4_5.EntityHuman; import net.minecraft.server.v1_4_5.EntityHuman;
import net.minecraft.server.v1_4_5.IInventory; import net.minecraft.server.v1_4_5.IInventory;
import net.minecraft.server.v1_4_5.ItemStack;
import net.minecraft.server.v1_4_5.PlayerInventory; import net.minecraft.server.v1_4_5.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried()); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried);
} }
} }
} }

View File

@@ -21,7 +21,7 @@ import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// Volatile // Volatile
@@ -40,30 +40,28 @@ import org.bukkit.craftbukkit.v1_4_6.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(x, y, z); Object chest = world.getTileEntity(x, y, z);
if (chest == null) if (chest == null) {
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) {
return false; return false;
} }
if (world.getTypeId(x - 1, y, z) == Block.CHEST.id) if (world.getTypeId(x, y, z + 1) == Block.CHEST.id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
if (world.getTypeId(x + 1, y, z) == Block.CHEST.id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
if (world.getTypeId(x, y, z - 1) == Block.CHEST.id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
if (world.getTypeId(x, y, z + 1) == Block.CHEST.id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1)); chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1));
} else if(world.getTypeId(x, y, z - 1) == Block.CHEST.id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
} else if (world.getTypeId(x + 1, y, z) == Block.CHEST.id) {
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
} else if (world.getTypeId(x - 1, y, z) == Block.CHEST.id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -134,12 +132,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_4_6;
import net.minecraft.server.v1_4_6.ContainerChest; import net.minecraft.server.v1_4_6.ContainerChest;
import net.minecraft.server.v1_4_6.EntityHuman; import net.minecraft.server.v1_4_6.EntityHuman;
import net.minecraft.server.v1_4_6.IInventory; import net.minecraft.server.v1_4_6.IInventory;
import net.minecraft.server.v1_4_6.ItemStack;
import net.minecraft.server.v1_4_6.PlayerInventory; import net.minecraft.server.v1_4_6.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried()); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried);
} }
} }
} }

View File

@@ -21,7 +21,7 @@ import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// Volatile // Volatile
@@ -40,30 +40,29 @@ import org.bukkit.craftbukkit.v1_4_R1.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(x, y, z); Object chest = world.getTileEntity(x, y, z);
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
if (world.getTypeId(x - 1, y, z) == Block.CHEST.id) if (world.getTypeId(x, y, z + 1) == Block.CHEST.id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
if (world.getTypeId(x + 1, y, z) == Block.CHEST.id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
if (world.getTypeId(x, y, z - 1) == Block.CHEST.id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
if (world.getTypeId(x, y, z + 1) == Block.CHEST.id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1)); chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1));
} else if(world.getTypeId(x, y, z - 1) == Block.CHEST.id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
} else if (world.getTypeId(x + 1, y, z) == Block.CHEST.id) {
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
} else if (world.getTypeId(x - 1, y, z) == Block.CHEST.id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -134,12 +133,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_4_R1;
import net.minecraft.server.v1_4_R1.ContainerChest; import net.minecraft.server.v1_4_R1.ContainerChest;
import net.minecraft.server.v1_4_R1.EntityHuman; import net.minecraft.server.v1_4_R1.EntityHuman;
import net.minecraft.server.v1_4_R1.IInventory; import net.minecraft.server.v1_4_R1.IInventory;
import net.minecraft.server.v1_4_R1.ItemStack;
import net.minecraft.server.v1_4_R1.PlayerInventory; import net.minecraft.server.v1_4_R1.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried()); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried);
} }
} }
} }

View File

@@ -21,7 +21,7 @@ import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// Volatile // Volatile
@@ -39,32 +39,31 @@ import org.bukkit.craftbukkit.v1_5_R2.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(x, y, z); Object chest = world.getTileEntity(x, y, z);
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = world.getTypeId(x, y, z); int id = world.getTypeId(x, y, z);
if (world.getTypeId(x - 1, y, z) == id) if (world.getTypeId(x, y, z + 1) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
if (world.getTypeId(x + 1, y, z) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
if (world.getTypeId(x, y, z - 1) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
if (world.getTypeId(x, y, z + 1) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1)); chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1));
} else if(world.getTypeId(x, y, z - 1) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
} else if (world.getTypeId(x + 1, y, z) == id) {
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
} else if (world.getTypeId(x - 1, y, z) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -137,12 +136,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_5_R2;
import net.minecraft.server.v1_5_R2.ContainerChest; import net.minecraft.server.v1_5_R2.ContainerChest;
import net.minecraft.server.v1_5_R2.EntityHuman; import net.minecraft.server.v1_5_R2.EntityHuman;
import net.minecraft.server.v1_5_R2.IInventory; import net.minecraft.server.v1_5_R2.IInventory;
import net.minecraft.server.v1_5_R2.ItemStack;
import net.minecraft.server.v1_5_R2.PlayerInventory; import net.minecraft.server.v1_5_R2.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried()); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried);
} }
} }
} }

View File

@@ -21,7 +21,7 @@ import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
//Volatile //Volatile
@@ -39,32 +39,31 @@ import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(x, y, z); Object chest = world.getTileEntity(x, y, z);
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = world.getTypeId(x, y, z); int id = world.getTypeId(x, y, z);
if (world.getTypeId(x - 1, y, z) == id) if (world.getTypeId(x, y, z + 1) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
if (world.getTypeId(x + 1, y, z) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
if (world.getTypeId(x, y, z - 1) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
if (world.getTypeId(x, y, z + 1) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1)); chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1));
} else if(world.getTypeId(x, y, z - 1) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
} else if (world.getTypeId(x + 1, y, z) == id) {
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
} else if (world.getTypeId(x - 1, y, z) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -137,12 +136,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_5_R3;
import net.minecraft.server.v1_5_R3.ContainerChest; import net.minecraft.server.v1_5_R3.ContainerChest;
import net.minecraft.server.v1_5_R3.EntityHuman; import net.minecraft.server.v1_5_R3.EntityHuman;
import net.minecraft.server.v1_5_R3.IInventory; import net.minecraft.server.v1_5_R3.IInventory;
import net.minecraft.server.v1_5_R3.ItemStack;
import net.minecraft.server.v1_5_R3.PlayerInventory; import net.minecraft.server.v1_5_R3.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried()); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried);
} }
} }
} }

View File

@@ -21,7 +21,7 @@ import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// Volatile // Volatile
@@ -39,32 +39,31 @@ import org.bukkit.craftbukkit.v1_6_R1.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(x, y, z); Object chest = world.getTileEntity(x, y, z);
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = world.getTypeId(x, y, z); int id = world.getTypeId(x, y, z);
if (world.getTypeId(x - 1, y, z) == id) if (world.getTypeId(x, y, z + 1) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
if (world.getTypeId(x + 1, y, z) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
if (world.getTypeId(x, y, z - 1) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
if (world.getTypeId(x, y, z + 1) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1)); chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1));
} else if(world.getTypeId(x, y, z - 1) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
} else if (world.getTypeId(x + 1, y, z) == id) {
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
} else if (world.getTypeId(x - 1, y, z) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -137,12 +136,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_6_R1;
import net.minecraft.server.v1_6_R1.ContainerChest; import net.minecraft.server.v1_6_R1.ContainerChest;
import net.minecraft.server.v1_6_R1.EntityHuman; import net.minecraft.server.v1_6_R1.EntityHuman;
import net.minecraft.server.v1_6_R1.IInventory; import net.minecraft.server.v1_6_R1.IInventory;
import net.minecraft.server.v1_6_R1.ItemStack;
import net.minecraft.server.v1_6_R1.PlayerInventory; import net.minecraft.server.v1_6_R1.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried()); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried);
} }
} }
} }

View File

@@ -21,7 +21,7 @@ import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// Volatile // Volatile
@@ -39,32 +39,31 @@ import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(x, y, z); Object chest = world.getTileEntity(x, y, z);
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = world.getTypeId(x, y, z); int id = world.getTypeId(x, y, z);
if (world.getTypeId(x - 1, y, z) == id) if (world.getTypeId(x, y, z + 1) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
if (world.getTypeId(x + 1, y, z) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
if (world.getTypeId(x, y, z - 1) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
if (world.getTypeId(x, y, z + 1) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1)); chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1));
} else if(world.getTypeId(x, y, z - 1) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
} else if (world.getTypeId(x + 1, y, z) == id) {
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
} else if (world.getTypeId(x - 1, y, z) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -137,12 +136,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_6_R2;
import net.minecraft.server.v1_6_R2.ContainerChest; import net.minecraft.server.v1_6_R2.ContainerChest;
import net.minecraft.server.v1_6_R2.EntityHuman; import net.minecraft.server.v1_6_R2.EntityHuman;
import net.minecraft.server.v1_6_R2.IInventory; import net.minecraft.server.v1_6_R2.IInventory;
import net.minecraft.server.v1_6_R2.ItemStack;
import net.minecraft.server.v1_6_R2.PlayerInventory; import net.minecraft.server.v1_6_R2.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried()); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried);
} }
} }
} }

View File

@@ -21,7 +21,7 @@ import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// Volatile // Volatile
@@ -39,32 +39,31 @@ import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(x, y, z); Object chest = world.getTileEntity(x, y, z);
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = world.getTypeId(x, y, z); int id = world.getTypeId(x, y, z);
if (world.getTypeId(x - 1, y, z) == id) if (world.getTypeId(x, y, z + 1) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
if (world.getTypeId(x + 1, y, z) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
if (world.getTypeId(x, y, z - 1) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
if (world.getTypeId(x, y, z + 1) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1)); chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1));
} else if(world.getTypeId(x, y, z - 1) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
} else if (world.getTypeId(x + 1, y, z) == id) {
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
} else if (world.getTypeId(x - 1, y, z) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -137,12 +136,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_6_R3;
import net.minecraft.server.v1_6_R3.ContainerChest; import net.minecraft.server.v1_6_R3.ContainerChest;
import net.minecraft.server.v1_6_R3.EntityHuman; import net.minecraft.server.v1_6_R3.EntityHuman;
import net.minecraft.server.v1_6_R3.IInventory; import net.minecraft.server.v1_6_R3.IInventory;
import net.minecraft.server.v1_6_R3.ItemStack;
import net.minecraft.server.v1_6_R3.PlayerInventory; import net.minecraft.server.v1_6_R3.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried()); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried);
} }
} }
} }

View File

@@ -21,7 +21,7 @@ import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
//Volatile //Volatile
@@ -40,32 +40,31 @@ import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(x, y, z); Object chest = world.getTileEntity(x, y, z);
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = Block.b(world.getType(x, y, z)); int id = Block.b(world.getType(x, y, z));
if (Block.b(world.getType(x - 1, y, z)) == id) if (Block.b(world.getType(x, y, z + 1)) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
if (Block.b(world.getType(x + 1, y, z)) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
if (Block.b(world.getType(x, y, z - 1)) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
if (Block.b(world.getType(x, y, z + 1)) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1)); chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1));
} else if(Block.b(world.getType(x, y, z - 1)) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
} else if (Block.b(world.getType(x + 1, y, z)) == id) {
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
} else if (Block.b(world.getType(x - 1, y, z)) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -138,12 +137,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_7_R1;
import net.minecraft.server.v1_7_R1.ContainerChest; import net.minecraft.server.v1_7_R1.ContainerChest;
import net.minecraft.server.v1_7_R1.EntityHuman; import net.minecraft.server.v1_7_R1.EntityHuman;
import net.minecraft.server.v1_7_R1.IInventory; import net.minecraft.server.v1_7_R1.IInventory;
import net.minecraft.server.v1_7_R1.ItemStack;
import net.minecraft.server.v1_7_R1.PlayerInventory; import net.minecraft.server.v1_7_R1.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried(), false); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried, false);
} }
} }
} }

View File

@@ -21,7 +21,7 @@ import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
//Volatile //Volatile
@@ -40,32 +40,31 @@ import org.bukkit.craftbukkit.v1_7_R2.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(x, y, z); Object chest = world.getTileEntity(x, y, z);
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = Block.b(world.getType(x, y, z)); int id = Block.b(world.getType(x, y, z));
if (Block.b(world.getType(x - 1, y, z)) == id) if (Block.b(world.getType(x, y, z + 1)) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
if (Block.b(world.getType(x + 1, y, z)) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
if (Block.b(world.getType(x, y, z - 1)) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
if (Block.b(world.getType(x, y, z + 1)) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1)); chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1));
} else if(Block.b(world.getType(x, y, z - 1)) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
} else if (Block.b(world.getType(x + 1, y, z)) == id) {
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
} else if (Block.b(world.getType(x - 1, y, z)) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -138,12 +137,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -30,6 +30,7 @@ import net.minecraft.util.com.mojang.authlib.GameProfile;
import org.bukkit.craftbukkit.v1_7_R2.CraftServer; import org.bukkit.craftbukkit.v1_7_R2.CraftServer;
@SuppressWarnings("deprecation") // Deprecated methods are used properly and will not change.
public class PlayerDataManager implements IPlayerDataManager { public class PlayerDataManager implements IPlayerDataManager {
@Override @Override

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_7_R2;
import net.minecraft.server.v1_7_R2.ContainerChest; import net.minecraft.server.v1_7_R2.ContainerChest;
import net.minecraft.server.v1_7_R2.EntityHuman; import net.minecraft.server.v1_7_R2.EntityHuman;
import net.minecraft.server.v1_7_R2.IInventory; import net.minecraft.server.v1_7_R2.IInventory;
import net.minecraft.server.v1_7_R2.ItemStack;
import net.minecraft.server.v1_7_R2.PlayerInventory; import net.minecraft.server.v1_7_R2.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried(), false); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried, false);
} }
} }
} }

View File

@@ -21,7 +21,7 @@ import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// Volatile // Volatile
@@ -40,32 +40,31 @@ import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(x, y, z); Object chest = world.getTileEntity(x, y, z);
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = Block.b(world.getType(x, y, z)); int id = Block.b(world.getType(x, y, z));
if (Block.b(world.getType(x - 1, y, z)) == id) if (Block.b(world.getType(x, y, z + 1)) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
if (Block.b(world.getType(x + 1, y, z)) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
if (Block.b(world.getType(x, y, z - 1)) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
if (Block.b(world.getType(x, y, z + 1)) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1)); chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1));
} else if(Block.b(world.getType(x, y, z - 1)) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
} else if (Block.b(world.getType(x + 1, y, z)) == id) {
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
} else if (Block.b(world.getType(x - 1, y, z)) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -138,12 +137,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_7_R3;
import net.minecraft.server.v1_7_R3.ContainerChest; import net.minecraft.server.v1_7_R3.ContainerChest;
import net.minecraft.server.v1_7_R3.EntityHuman; import net.minecraft.server.v1_7_R3.EntityHuman;
import net.minecraft.server.v1_7_R3.IInventory; import net.minecraft.server.v1_7_R3.IInventory;
import net.minecraft.server.v1_7_R3.ItemStack;
import net.minecraft.server.v1_7_R3.PlayerInventory; import net.minecraft.server.v1_7_R3.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried(), false); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried, false);
} }
} }
} }

View File

@@ -21,7 +21,7 @@ import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// Volatile // Volatile
@@ -40,32 +40,31 @@ import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(x, y, z); Object chest = world.getTileEntity(x, y, z);
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = Block.getId(world.getType(x, y, z)); int id = Block.getId(world.getType(x, y, z));
if (Block.getId(world.getType(x - 1, y, z)) == id) if (Block.getId(world.getType(x, y, z + 1)) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
if (Block.getId(world.getType(x + 1, y, z)) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
if (Block.getId(world.getType(x, y, z - 1)) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
if (Block.getId(world.getType(x, y, z + 1)) == id)
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1)); chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x, y, z + 1));
} else if(Block.getId(world.getType(x, y, z - 1)) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x, y, z - 1), (IInventory) chest);
} else if (Block.getId(world.getType(x + 1, y, z)) == id) {
chest = new InventoryLargeChest("Large chest", (IInventory) chest, (TileEntityChest) world.getTileEntity(x + 1, y, z));
} else if (Block.getId(world.getType(x - 1, y, z)) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(x - 1, y, z), (IInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -138,12 +137,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_7_R4;
import net.minecraft.server.v1_7_R4.ContainerChest; import net.minecraft.server.v1_7_R4.ContainerChest;
import net.minecraft.server.v1_7_R4.EntityHuman; import net.minecraft.server.v1_7_R4.EntityHuman;
import net.minecraft.server.v1_7_R4.IInventory; import net.minecraft.server.v1_7_R4.IInventory;
import net.minecraft.server.v1_7_R4.ItemStack;
import net.minecraft.server.v1_7_R4.PlayerInventory; import net.minecraft.server.v1_7_R4.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried(), false); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried, false);
} }
} }
} }

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_8_R1;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
//Volatile //Volatile
@@ -40,32 +40,31 @@ import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(new BlockPosition(x, y, z)); Object chest = world.getTileEntity(new BlockPosition(x, y, z));
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock()); int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock());
if (Block.getId(world.getType(new BlockPosition(x - 1, y, z)).getBlock()) == id) if (Block.getId(world.getType(new BlockPosition(x, y, z + 1)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x - 1, y, z)), (ITileInventory) chest);
if (Block.getId(world.getType(new BlockPosition(x + 1, y, z)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x + 1, y, z)));
if (Block.getId(world.getType(new BlockPosition(x, y, z - 1)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z - 1)), (ITileInventory) chest);
if (Block.getId(world.getType(new BlockPosition(x, y, z + 1)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z + 1))); chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z + 1)));
} else if (Block.getId(world.getType(new BlockPosition(x, y, z - 1)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z - 1)), (ITileInventory) chest);
} else if (Block.getId(world.getType(new BlockPosition(x + 1, y, z)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x + 1, y, z)));
} else if (Block.getId(world.getType(new BlockPosition(x - 1, y, z)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x - 1, y, z)), (ITileInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -131,12 +130,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_8_R1;
import net.minecraft.server.v1_8_R1.ContainerChest; import net.minecraft.server.v1_8_R1.ContainerChest;
import net.minecraft.server.v1_8_R1.EntityHuman; import net.minecraft.server.v1_8_R1.EntityHuman;
import net.minecraft.server.v1_8_R1.IInventory; import net.minecraft.server.v1_8_R1.IInventory;
import net.minecraft.server.v1_8_R1.ItemStack;
import net.minecraft.server.v1_8_R1.PlayerInventory; import net.minecraft.server.v1_8_R1.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried(), false); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried, false);
} }
} }
} }

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_8_R2;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
//Volatile //Volatile
@@ -40,32 +40,31 @@ import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(new BlockPosition(x, y, z)); Object chest = world.getTileEntity(new BlockPosition(x, y, z));
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock()); int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock());
if (Block.getId(world.getType(new BlockPosition(x - 1, y, z)).getBlock()) == id) if (Block.getId(world.getType(new BlockPosition(x, y, z + 1)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x - 1, y, z)), (ITileInventory) chest);
if (Block.getId(world.getType(new BlockPosition(x + 1, y, z)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x + 1, y, z)));
if (Block.getId(world.getType(new BlockPosition(x, y, z - 1)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z - 1)), (ITileInventory) chest);
if (Block.getId(world.getType(new BlockPosition(x, y, z + 1)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z + 1))); chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z + 1)));
} else if (Block.getId(world.getType(new BlockPosition(x, y, z - 1)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z - 1)), (ITileInventory) chest);
} else if (Block.getId(world.getType(new BlockPosition(x + 1, y, z)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x + 1, y, z)));
} else if (Block.getId(world.getType(new BlockPosition(x - 1, y, z)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x - 1, y, z)), (ITileInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -131,12 +130,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_8_R2;
import net.minecraft.server.v1_8_R2.ContainerChest; import net.minecraft.server.v1_8_R2.ContainerChest;
import net.minecraft.server.v1_8_R2.EntityHuman; import net.minecraft.server.v1_8_R2.EntityHuman;
import net.minecraft.server.v1_8_R2.IInventory; import net.minecraft.server.v1_8_R2.IInventory;
import net.minecraft.server.v1_8_R2.ItemStack;
import net.minecraft.server.v1_8_R2.PlayerInventory; import net.minecraft.server.v1_8_R2.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried(), false); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried, false);
} }
} }
} }

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_8_R3;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
//Volatile //Volatile
@@ -40,32 +40,31 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(new BlockPosition(x, y, z)); Object chest = world.getTileEntity(new BlockPosition(x, y, z));
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock()); int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock());
if (Block.getId(world.getType(new BlockPosition(x - 1, y, z)).getBlock()) == id) if (Block.getId(world.getType(new BlockPosition(x, y, z + 1)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x - 1, y, z)), (ITileInventory) chest);
if (Block.getId(world.getType(new BlockPosition(x + 1, y, z)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x + 1, y, z)));
if (Block.getId(world.getType(new BlockPosition(x, y, z - 1)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z - 1)), (ITileInventory) chest);
if (Block.getId(world.getType(new BlockPosition(x, y, z + 1)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z + 1))); chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z + 1)));
} else if (Block.getId(world.getType(new BlockPosition(x, y, z - 1)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z - 1)), (ITileInventory) chest);
} else if (Block.getId(world.getType(new BlockPosition(x + 1, y, z)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x + 1, y, z)));
} else if (Block.getId(world.getType(new BlockPosition(x - 1, y, z)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x - 1, y, z)), (ITileInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -131,12 +130,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_8_R3;
import net.minecraft.server.v1_8_R3.ContainerChest; import net.minecraft.server.v1_8_R3.ContainerChest;
import net.minecraft.server.v1_8_R3.EntityHuman; import net.minecraft.server.v1_8_R3.EntityHuman;
import net.minecraft.server.v1_8_R3.IInventory; import net.minecraft.server.v1_8_R3.IInventory;
import net.minecraft.server.v1_8_R3.ItemStack;
import net.minecraft.server.v1_8_R3.PlayerInventory; import net.minecraft.server.v1_8_R3.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried(), false); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried, false);
} }
} }
} }

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_9_R1;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// Volatile // Volatile
@@ -41,32 +41,31 @@ import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(new BlockPosition(x, y, z)); Object chest = world.getTileEntity(new BlockPosition(x, y, z));
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock()); int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock());
if (Block.getId(world.getType(new BlockPosition(x - 1, y, z)).getBlock()) == id) if (Block.getId(world.getType(new BlockPosition(x, y, z + 1)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x - 1, y, z)), (ITileInventory) chest);
if (Block.getId(world.getType(new BlockPosition(x + 1, y, z)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x + 1, y, z)));
if (Block.getId(world.getType(new BlockPosition(x, y, z - 1)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z - 1)), (ITileInventory) chest);
if (Block.getId(world.getType(new BlockPosition(x, y, z + 1)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z + 1))); chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z + 1)));
} else if (Block.getId(world.getType(new BlockPosition(x, y, z - 1)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z - 1)), (ITileInventory) chest);
} else if (Block.getId(world.getType(new BlockPosition(x + 1, y, z)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x + 1, y, z)));
} else if (Block.getId(world.getType(new BlockPosition(x - 1, y, z)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x - 1, y, z)), (ITileInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -133,12 +132,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_9_R1;
import net.minecraft.server.v1_9_R1.ContainerChest; import net.minecraft.server.v1_9_R1.ContainerChest;
import net.minecraft.server.v1_9_R1.EntityHuman; import net.minecraft.server.v1_9_R1.EntityHuman;
import net.minecraft.server.v1_9_R1.IInventory; import net.minecraft.server.v1_9_R1.IInventory;
import net.minecraft.server.v1_9_R1.ItemStack;
import net.minecraft.server.v1_9_R1.PlayerInventory; import net.minecraft.server.v1_9_R1.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried(), false); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried, false);
} }
} }
} }

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_9_R2;
import com.lishid.openinv.internal.IAnySilentContainer; import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockState; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// Volatile // Volatile
@@ -41,32 +41,31 @@ import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
public class AnySilentContainer implements IAnySilentContainer { public class AnySilentContainer implements IAnySilentContainer {
@Override @Override
public boolean isAnySilentContainer(BlockState block) { public boolean isAnySilentContainer(org.bukkit.block.Block block) {
return block instanceof org.bukkit.block.Chest; return block.getType() == Material.ENDER_CHEST || block.getState() instanceof org.bukkit.block.Chest;
} }
@Override @Override
public boolean activateContainer(Player p, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateContainer(Player p, boolean silentchest, int x, int y, int z) {
EntityPlayer player = ((CraftPlayer) p).getHandle(); EntityPlayer player = ((CraftPlayer) p).getHandle();
World world = player.world; World world = player.world;
Object chest = world.getTileEntity(new BlockPosition(x, y, z)); Object chest = world.getTileEntity(new BlockPosition(x, y, z));
if (chest == null)
return false;
if (!anychest && isAnyContainerNeeded(p, x, y, z)) { if (chest == null) {
return false; return false;
} }
int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock()); int id = Block.getId(world.getType(new BlockPosition(x, y, z)).getBlock());
if (Block.getId(world.getType(new BlockPosition(x - 1, y, z)).getBlock()) == id) if (Block.getId(world.getType(new BlockPosition(x, y, z + 1)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x - 1, y, z)), (ITileInventory) chest);
if (Block.getId(world.getType(new BlockPosition(x + 1, y, z)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x + 1, y, z)));
if (Block.getId(world.getType(new BlockPosition(x, y, z - 1)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z - 1)), (ITileInventory) chest);
if (Block.getId(world.getType(new BlockPosition(x, y, z + 1)).getBlock()) == id)
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z + 1))); chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z + 1)));
} else if (Block.getId(world.getType(new BlockPosition(x, y, z - 1)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x, y, z - 1)), (ITileInventory) chest);
} else if (Block.getId(world.getType(new BlockPosition(x + 1, y, z)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (ITileInventory) chest, (TileEntityChest) world.getTileEntity(new BlockPosition(x + 1, y, z)));
} else if (Block.getId(world.getType(new BlockPosition(x - 1, y, z)).getBlock()) == id) {
chest = new InventoryLargeChest("Large chest", (TileEntityChest) world.getTileEntity(new BlockPosition(x - 1, y, z)), (ITileInventory) chest);
}
boolean returnValue = false; boolean returnValue = false;
if (!silentchest) { if (!silentchest) {
@@ -133,12 +132,12 @@ public class AnySilentContainer implements IAnySilentContainer {
} }
/** /**
* @deprecated Use {@link #activateContainer(Player, boolean, boolean, int, int, int)}. * @deprecated Use {@link #activateContainer(Player, boolean, int, int, int)}.
*/ */
@Deprecated @Deprecated
@Override @Override
public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) { public boolean activateChest(Player player, boolean anychest, boolean silentchest, int x, int y, int z) {
return !activateContainer(player, anychest, silentchest, x, y, z); return !activateContainer(player, silentchest, x, y, z);
} }
/** /**

View File

@@ -20,6 +20,7 @@ package com.lishid.openinv.internal.v1_9_R2;
import net.minecraft.server.v1_9_R2.ContainerChest; import net.minecraft.server.v1_9_R2.ContainerChest;
import net.minecraft.server.v1_9_R2.EntityHuman; import net.minecraft.server.v1_9_R2.EntityHuman;
import net.minecraft.server.v1_9_R2.IInventory; import net.minecraft.server.v1_9_R2.IInventory;
import net.minecraft.server.v1_9_R2.ItemStack;
import net.minecraft.server.v1_9_R2.PlayerInventory; import net.minecraft.server.v1_9_R2.PlayerInventory;
public class SilentContainerChest extends ContainerChest { public class SilentContainerChest extends ContainerChest {
@@ -38,8 +39,9 @@ public class SilentContainerChest extends ContainerChest {
PlayerInventory playerinventory = entityHuman.inventory; PlayerInventory playerinventory = entityHuman.inventory;
if (playerinventory.getCarried() != null) { if (playerinventory.getCarried() != null) {
entityHuman.drop(playerinventory.getCarried(), false); ItemStack carried = playerinventory.getCarried();
playerinventory.setCarried(null); playerinventory.setCarried(null);
entityHuman.drop(carried, false);
} }
} }
} }

View File

@@ -107,7 +107,7 @@ public class OpenInv extends JavaPlugin {
accessor = new InternalAccessor(this); accessor = new InternalAccessor(this);
// Version check // Version check
if (!accessor.initialize(getServer())) { if (!accessor.initialize(getServer())) {
getLogger().info("Your version of CraftBukkit (" + accessor.getVersion() + ")is not supported."); getLogger().info("Your version of CraftBukkit (" + accessor.getVersion() + ") is not supported.");
getLogger().info("Please look for an updated version of OpenInv."); getLogger().info("Please look for an updated version of OpenInv.");
pm.disablePlugin(this); pm.disablePlugin(this);
return; return;

View File

@@ -47,45 +47,43 @@ public class OpenInvPlayerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getAction() != Action.RIGHT_CLICK_BLOCK || event.getPlayer().isSneaking() if (event.getAction() != Action.RIGHT_CLICK_BLOCK || event.getPlayer().isSneaking()
|| event.useInteractedBlock() == Result.DENY) { || event.useInteractedBlock() == Result.DENY
|| !plugin.getAnySilentContainer().isAnySilentContainer(event.getClickedBlock())) {
return; return;
} }
Player player = event.getPlayer(); Player player = event.getPlayer();
boolean anychest = OpenInv.hasPermission(player, Permissions.PERM_ANYCHEST) && plugin.getPlayerAnyChestStatus(player);
int x = event.getClickedBlock().getX();
int y = event.getClickedBlock().getY();
int z = event.getClickedBlock().getZ();
boolean needsAnyChest = plugin.getAnySilentContainer().isAnyContainerNeeded(player, x, y, z);
if (!anychest && needsAnyChest) {
return;
}
boolean silentchest = OpenInv.hasPermission(player, Permissions.PERM_SILENT) && plugin.getPlayerSilentChestStatus(player);
if (event.getClickedBlock().getType() == org.bukkit.Material.ENDER_CHEST) { if (event.getClickedBlock().getType() == org.bukkit.Material.ENDER_CHEST) {
if (OpenInv.hasPermission(player, Permissions.PERM_SILENT) if (silentchest || anychest) {
&& plugin.getPlayerSilentChestStatus(player)) { // TODO: anychest is silent
// TODO: Bypasses blocks on top, anychest also does not work
event.setCancelled(true); event.setCancelled(true);
player.openInventory(player.getEnderChest()); player.openInventory(player.getEnderChest());
} }
return; return;
} }
if (plugin.getAnySilentContainer().isAnySilentContainer(event.getClickedBlock().getState())) { // If anychest or silentchest is active
if ((anychest || silentchest) && plugin.getAnySilentContainer().activateContainer(player, silentchest, x, y, z)) {
boolean silentchest = OpenInv.hasPermission(player, Permissions.PERM_SILENT) && plugin.getPlayerSilentChestStatus(player); if (silentchest && plugin.notifySilentChest() && needsAnyChest && plugin.notifyAnyChest()) {
boolean anychest = OpenInv.hasPermission(player, Permissions.PERM_ANYCHEST) && plugin.getPlayerAnyChestStatus(player); player.sendMessage("You are opening a blocked chest silently.");
} else if (silentchest && plugin.notifySilentChest()) {
int x = event.getClickedBlock().getX(); player.sendMessage("You are opening a chest silently.");
int y = event.getClickedBlock().getY(); } else if (needsAnyChest && plugin.notifyAnyChest()) {
int z = event.getClickedBlock().getZ(); player.sendMessage("You are opening a blocked chest.");
// If anychest or silentchest is active
if (anychest || silentchest) {
if (plugin.getAnySilentContainer().activateContainer(player, anychest, silentchest, x, y, z)) {
if (silentchest && plugin.notifySilentChest() && anychest && plugin.notifyAnyChest()) {
player.sendMessage("You are opening a blocked chest silently.");
} else if (silentchest && plugin.notifySilentChest()) {
player.sendMessage("You are opening a chest silently.");
} else if (anychest && plugin.notifyAnyChest()) {
// TODO fix anychest always claiming chest is blocked
player.sendMessage("You are opening a blocked chest.");
}
event.setCancelled(true);
}
} }
event.setCancelled(true);
} }
} }

View File

@@ -10,30 +10,30 @@ commands:
aliases: [oi, inv, open] aliases: [oi, inv, open]
description: Open a player's inventory description: Open a player's inventory
permission: OpenInv.*;OpenInv.openinv permission: OpenInv.*;OpenInv.openinv
usage: | usage: |-
/<command> - Open last person's inventory /<command> - Open last person's inventory
/<command> <Player> - Open a player's inventory /<command> <Player> - Open a player's inventory
openender: openender:
aliases: [oe] aliases: [oe]
description: Opens the enderchest of a player description: Opens the enderchest of a player
permission: OpenInv.*;OpenInv.openender permission: OpenInv.*;OpenInv.openender
usage: | usage: |-
/<command> <Player> - Opens a player's enderchest /<command> <Player> - Opens a player's enderchest
searchinv: searchinv:
aliases: [si] aliases: [si]
description: Search and list players having a specific item description: Search and list players having a specific item
permission: OpenInv.*;OpenInv.search permission: OpenInv.*;OpenInv.search
usage: | usage: |-
/<command> <Item> [MinAmount] - Item can be the Item ID or the CraftBukkit Item Name, MinAmount is the minimum amount to be considered. /<command> <Item> [MinAmount] - Item can be the Item ID or the CraftBukkit Item Name, MinAmount is the minimum amount to be considered.
silentchest: silentchest:
aliases: [sc, silent] aliases: [sc, silent]
description: Toggle silent chest function, which hides the animation of a chest when opened or closed, and suppresses the sound. description: Toggle silent chest function, which hides the animation of a chest when opened or closed, and suppresses the sound.
permission: OpenInv.*;OpenInv.silent permission: OpenInv.*;OpenInv.silent
usage: | usage: |-
/<command> [Check] - Checks whether silent chest is enabled /<command> [Check] - Checks whether silent chest is enabled
anychest: anychest:
aliases: [ac] aliases: [ac]
description: Toggle anychest function, which allows opening of blocked chests. description: Toggle anychest function, which allows opening of blocked chests.
permission: OpenInv.*;OpenInv.anychest permission: OpenInv.*;OpenInv.anychest
usage: | usage: |-
/<command> [Check] - Checks whether anychest is enabled /<command> [Check] - Checks whether anychest is enabled