Updated to CraftBukkit 1.9
This commit is contained in:
		@@ -23,9 +23,10 @@ import org.bukkit.entity.Player;
 | 
			
		||||
import com.lishid.openinv.OpenInv;
 | 
			
		||||
 | 
			
		||||
// Volatile
 | 
			
		||||
import net.minecraft.server.v1_8_R3.*;
 | 
			
		||||
import net.minecraft.server.v1_9_R1.*;
 | 
			
		||||
import net.minecraft.server.v1_9_R1.BlockChest.Type;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.craftbukkit.v1_8_R3.entity.*;
 | 
			
		||||
import org.bukkit.craftbukkit.v1_9_R1.entity.*;
 | 
			
		||||
 | 
			
		||||
public class AnySilentChest {
 | 
			
		||||
    public boolean isAnyChestNeeded(Player p, int x, int y, int z) {
 | 
			
		||||
@@ -33,7 +34,7 @@ public class AnySilentChest {
 | 
			
		||||
        BlockPosition position = new BlockPosition(x, y, z);
 | 
			
		||||
        EntityPlayer player = ((CraftPlayer) p).getHandle();
 | 
			
		||||
        World world = player.world;
 | 
			
		||||
        BlockChest chest = (BlockChest) (((BlockChest) world.getType(position).getBlock()).b == 1 ?
 | 
			
		||||
        BlockChest chest = (BlockChest) (((BlockChest) world.getType(position).getBlock()).g == Type.TRAP ?
 | 
			
		||||
                Block.getByName("trapped_chest") : Block.getByName("chest"));
 | 
			
		||||
 | 
			
		||||
        // If block on top
 | 
			
		||||
@@ -59,7 +60,11 @@ public class AnySilentChest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private boolean blockOnTop(World world, BlockPosition position) {
 | 
			
		||||
        return world.getType(position.up()).getBlock().isOccluding();
 | 
			
		||||
        // return world.getType(position.up()).getBlock().isOccluding();
 | 
			
		||||
 | 
			
		||||
        // TODO: Does this work?
 | 
			
		||||
        Block block = world.getType(position.up()).getBlock();
 | 
			
		||||
        return block.isOccluding(block.getBlockData());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private boolean ocelotOnTop(World world, BlockPosition position) {
 | 
			
		||||
@@ -89,7 +94,7 @@ public class AnySilentChest {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        BlockChest chest = (BlockChest) (((BlockChest) world.getType(position).getBlock()).b == 1 ?
 | 
			
		||||
        BlockChest chest = (BlockChest) (((BlockChest) world.getType(position).getBlock()).g == Type.TRAP ?
 | 
			
		||||
                Block.getByName("trapped_chest") : Block.getByName("chest"));
 | 
			
		||||
 | 
			
		||||
        TileEntity tileEntity = world.getTileEntity(position);
 | 
			
		||||
 
 | 
			
		||||
@@ -4,16 +4,16 @@ import java.util.Iterator;
 | 
			
		||||
 | 
			
		||||
import com.google.common.collect.Iterators;
 | 
			
		||||
 | 
			
		||||
import net.minecraft.server.v1_8_R3.EnumDirection;
 | 
			
		||||
import net.minecraft.server.v1_8_R3.EnumDirection.EnumDirectionLimit;
 | 
			
		||||
import net.minecraft.server.v1_9_R1.EnumDirection;
 | 
			
		||||
import net.minecraft.server.v1_9_R1.EnumDirection.EnumDirectionLimit;
 | 
			
		||||
 | 
			
		||||
public enum EnumDirectionList implements Iterable<EnumDirection> {
 | 
			
		||||
    HORIZONTAL(EnumDirectionLimit.HORIZONTAL),
 | 
			
		||||
    VERTICAL(EnumDirectionLimit.VERTICAL);
 | 
			
		||||
 | 
			
		||||
    private final EnumDirectionLimit list;
 | 
			
		||||
    private final EnumDirection.EnumDirectionLimit list;
 | 
			
		||||
 | 
			
		||||
    private EnumDirectionList(EnumDirectionLimit list) {
 | 
			
		||||
    EnumDirectionList(EnumDirection.EnumDirectionLimit list) {
 | 
			
		||||
        this.list = list;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -25,9 +25,9 @@ import com.lishid.openinv.OpenInv;
 | 
			
		||||
import com.lishid.openinv.Permissions;
 | 
			
		||||
 | 
			
		||||
// Volatile
 | 
			
		||||
import net.minecraft.server.v1_8_R3.*;
 | 
			
		||||
import net.minecraft.server.v1_9_R1.*;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.*;
 | 
			
		||||
import org.bukkit.craftbukkit.v1_9_R1.inventory.*;
 | 
			
		||||
 | 
			
		||||
public class InventoryAccess {
 | 
			
		||||
    public boolean check(Inventory inventory, HumanEntity player) {
 | 
			
		||||
@@ -49,16 +49,17 @@ public class InventoryAccess {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    private IInventory grabInventory(Inventory inventory) {
 | 
			
		||||
        if(inventory instanceof CraftInventory) {
 | 
			
		||||
        if (inventory instanceof CraftInventory) {
 | 
			
		||||
            return ((CraftInventory) inventory).getInventory();
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        // Use reflection to find the inventory
 | 
			
		||||
        Class<? extends Inventory> clazz = inventory.getClass();
 | 
			
		||||
        IInventory result = null;
 | 
			
		||||
        for(Field f : clazz.getDeclaredFields()) {
 | 
			
		||||
        for (Field f : clazz.getDeclaredFields()) {
 | 
			
		||||
            f.setAccessible(true);
 | 
			
		||||
            if(IInventory.class.isAssignableFrom(f.getDeclaringClass())) {
 | 
			
		||||
            
 | 
			
		||||
            if (IInventory.class.isAssignableFrom(f.getDeclaringClass())) {
 | 
			
		||||
                try {
 | 
			
		||||
                    result = (IInventory) f.get(inventory);
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -26,9 +26,9 @@ import com.lishid.openinv.OpenInv;
 | 
			
		||||
import com.mojang.authlib.GameProfile;
 | 
			
		||||
 | 
			
		||||
// Volatile
 | 
			
		||||
import net.minecraft.server.v1_8_R3.*;
 | 
			
		||||
import net.minecraft.server.v1_9_R1.*;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.craftbukkit.v1_8_R3.*;
 | 
			
		||||
import org.bukkit.craftbukkit.v1_9_R1.*;
 | 
			
		||||
 | 
			
		||||
public class PlayerDataManager {
 | 
			
		||||
    public Player loadPlayer(UUID uuid) {
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@
 | 
			
		||||
package com.lishid.openinv.internal;
 | 
			
		||||
 | 
			
		||||
// Volatile
 | 
			
		||||
import net.minecraft.server.v1_8_R3.*;
 | 
			
		||||
import net.minecraft.server.v1_9_R1.*;
 | 
			
		||||
 | 
			
		||||
public class SilentContainerChest extends ContainerChest {
 | 
			
		||||
    public IInventory inv;
 | 
			
		||||
 
 | 
			
		||||
@@ -2,12 +2,13 @@ package com.lishid.openinv.internal;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHumanEntity;
 | 
			
		||||
import org.bukkit.Location;
 | 
			
		||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftHumanEntity;
 | 
			
		||||
import org.bukkit.entity.HumanEntity;
 | 
			
		||||
import org.bukkit.inventory.InventoryHolder;
 | 
			
		||||
 | 
			
		||||
// Volatile
 | 
			
		||||
import net.minecraft.server.v1_8_R3.*;
 | 
			
		||||
import net.minecraft.server.v1_9_R1.*;
 | 
			
		||||
 | 
			
		||||
public class SilentInventory implements ITileInventory {
 | 
			
		||||
    public ITileInventory inv;
 | 
			
		||||
@@ -17,8 +18,8 @@ public class SilentInventory implements ITileInventory {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean r_() {
 | 
			
		||||
        return inv.r_();
 | 
			
		||||
    public boolean x_() {
 | 
			
		||||
        return inv.x_();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -27,8 +28,8 @@ public class SilentInventory implements ITileInventory {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public ChestLock i() {
 | 
			
		||||
        return inv.i();
 | 
			
		||||
    public ChestLock y_() {
 | 
			
		||||
        return inv.y_();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -92,8 +93,8 @@ public class SilentInventory implements ITileInventory {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void b(int i, int i1) {
 | 
			
		||||
        inv.b(i, i1);
 | 
			
		||||
    public void setProperty(int i, int i1) {
 | 
			
		||||
        inv.setProperty(i, i1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -136,6 +137,11 @@ public class SilentInventory implements ITileInventory {
 | 
			
		||||
        inv.setMaxStackSize(i);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Location getLocation() {
 | 
			
		||||
        return inv.getLocation();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String getName() {
 | 
			
		||||
        return inv.getName();
 | 
			
		||||
 
 | 
			
		||||
@@ -23,10 +23,10 @@ import org.bukkit.inventory.InventoryHolder;
 | 
			
		||||
import com.lishid.openinv.OpenInv;
 | 
			
		||||
 | 
			
		||||
// Volatile
 | 
			
		||||
import net.minecraft.server.v1_8_R3.*;
 | 
			
		||||
import net.minecraft.server.v1_9_R1.*;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.craftbukkit.v1_8_R3.entity.*;
 | 
			
		||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.*;
 | 
			
		||||
import org.bukkit.craftbukkit.v1_9_R1.entity.*;
 | 
			
		||||
import org.bukkit.craftbukkit.v1_9_R1.inventory.*;
 | 
			
		||||
 | 
			
		||||
public class SpecialEnderChest extends InventorySubcontainer {
 | 
			
		||||
    private final CraftInventory inventory = new CraftInventory(this);
 | 
			
		||||
 
 | 
			
		||||
@@ -22,11 +22,16 @@ import org.bukkit.inventory.Inventory;
 | 
			
		||||
import com.lishid.openinv.OpenInv;
 | 
			
		||||
 | 
			
		||||
// Volatile
 | 
			
		||||
import net.minecraft.server.v1_8_R3.*;
 | 
			
		||||
import net.minecraft.server.v1_9_R1.*;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.craftbukkit.v1_8_R3.entity.*;
 | 
			
		||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.*;
 | 
			
		||||
import org.bukkit.craftbukkit.v1_9_R1.entity.*;
 | 
			
		||||
import org.bukkit.craftbukkit.v1_9_R1.inventory.*;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * -----------------------------------------------
 | 
			
		||||
 * This class still needs to be updated for 1.9.
 | 
			
		||||
 * -----------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
public class SpecialPlayerInventory extends PlayerInventory {
 | 
			
		||||
    private final CraftInventory inventory = new CraftInventory(this);
 | 
			
		||||
    private final ItemStack[] extra = new ItemStack[5];
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,7 @@ public class OpenInvEntityListener implements Listener {
 | 
			
		||||
 | 
			
		||||
        Player player = (Player) attacker;
 | 
			
		||||
 | 
			
		||||
        if (player.getItemInHand().getType() == OpenInv.getOpenInvItem()) {
 | 
			
		||||
        if (player.getInventory().getItemInMainHand().getType() == OpenInv.getOpenInvItem()) {
 | 
			
		||||
            if (!OpenInv.getPlayerItemOpenInvStatus(player) || !OpenInv.hasPermission(player, Permissions.PERM_OPENINV)) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -143,7 +143,7 @@ public class OpenInvPlayerListener implements Listener {
 | 
			
		||||
                }
 | 
			
		||||
            case RIGHT_CLICK_AIR:
 | 
			
		||||
                // OpenInv item
 | 
			
		||||
                if (player.getItemInHand().getType() == OpenInv.getOpenInvItem() && OpenInv.getPlayerItemOpenInvStatus(player) && OpenInv.hasPermission(player, Permissions.PERM_OPENINV)) {
 | 
			
		||||
                if (player.getInventory().getItemInMainHand().getType() == OpenInv.getOpenInvItem() && OpenInv.getPlayerItemOpenInvStatus(player) && OpenInv.hasPermission(player, Permissions.PERM_OPENINV)) {
 | 
			
		||||
                    player.performCommand("openinv");
 | 
			
		||||
                }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
name: OpenInv
 | 
			
		||||
main: com.lishid.openinv.OpenInv
 | 
			
		||||
version: 2.3.4
 | 
			
		||||
version: 2.3.5
 | 
			
		||||
author: lishid
 | 
			
		||||
description: >
 | 
			
		||||
             This plugin allows you to open a player's inventory as a chest and interact with it in real time.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user