diff --git a/pom.xml b/pom.xml
index 1505c64..391df44 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.lishid
openinv
jar
- 2.3.4
+ 2.3.5
OpenInv
http://dev.bukkit.org/bukkit-plugins/openinv/
@@ -23,14 +23,14 @@
org.bukkit
bukkit
- 1.8.8-R0.1-SNAPSHOT
+ 1.9-R0.1-SNAPSHOT
provided
org.bukkit
craftbukkit
- 1.8.8-R0.1-SNAPSHOT
+ 1.9-R0.1-SNAPSHOT
provided
diff --git a/src/main/java/com/lishid/openinv/internal/AnySilentChest.java b/src/main/java/com/lishid/openinv/internal/AnySilentChest.java
index 6c88ad6..0f4fb06 100644
--- a/src/main/java/com/lishid/openinv/internal/AnySilentChest.java
+++ b/src/main/java/com/lishid/openinv/internal/AnySilentChest.java
@@ -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);
diff --git a/src/main/java/com/lishid/openinv/internal/EnumDirectionList.java b/src/main/java/com/lishid/openinv/internal/EnumDirectionList.java
index 56c5b48..fece744 100644
--- a/src/main/java/com/lishid/openinv/internal/EnumDirectionList.java
+++ b/src/main/java/com/lishid/openinv/internal/EnumDirectionList.java
@@ -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 {
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;
}
diff --git a/src/main/java/com/lishid/openinv/internal/InventoryAccess.java b/src/main/java/com/lishid/openinv/internal/InventoryAccess.java
index 9d6940b..ef1357f 100644
--- a/src/main/java/com/lishid/openinv/internal/InventoryAccess.java
+++ b/src/main/java/com/lishid/openinv/internal/InventoryAccess.java
@@ -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);
}
diff --git a/src/main/java/com/lishid/openinv/internal/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/PlayerDataManager.java
index d6fa177..9a06cbb 100644
--- a/src/main/java/com/lishid/openinv/internal/PlayerDataManager.java
+++ b/src/main/java/com/lishid/openinv/internal/PlayerDataManager.java
@@ -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) {
diff --git a/src/main/java/com/lishid/openinv/internal/SilentContainerChest.java b/src/main/java/com/lishid/openinv/internal/SilentContainerChest.java
index b9bc4be..2be1435 100644
--- a/src/main/java/com/lishid/openinv/internal/SilentContainerChest.java
+++ b/src/main/java/com/lishid/openinv/internal/SilentContainerChest.java
@@ -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;
diff --git a/src/main/java/com/lishid/openinv/internal/SilentInventory.java b/src/main/java/com/lishid/openinv/internal/SilentInventory.java
index a2f50a6..b05211c 100644
--- a/src/main/java/com/lishid/openinv/internal/SilentInventory.java
+++ b/src/main/java/com/lishid/openinv/internal/SilentInventory.java
@@ -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();
diff --git a/src/main/java/com/lishid/openinv/internal/SpecialEnderChest.java b/src/main/java/com/lishid/openinv/internal/SpecialEnderChest.java
index 91f7b94..40d4a5d 100644
--- a/src/main/java/com/lishid/openinv/internal/SpecialEnderChest.java
+++ b/src/main/java/com/lishid/openinv/internal/SpecialEnderChest.java
@@ -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);
diff --git a/src/main/java/com/lishid/openinv/internal/SpecialPlayerInventory.java b/src/main/java/com/lishid/openinv/internal/SpecialPlayerInventory.java
index fe1cdad..390dc03 100644
--- a/src/main/java/com/lishid/openinv/internal/SpecialPlayerInventory.java
+++ b/src/main/java/com/lishid/openinv/internal/SpecialPlayerInventory.java
@@ -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];
diff --git a/src/main/java/com/lishid/openinv/listeners/OpenInvEntityListener.java b/src/main/java/com/lishid/openinv/listeners/OpenInvEntityListener.java
index 3508af5..25b6785 100644
--- a/src/main/java/com/lishid/openinv/listeners/OpenInvEntityListener.java
+++ b/src/main/java/com/lishid/openinv/listeners/OpenInvEntityListener.java
@@ -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;
}
diff --git a/src/main/java/com/lishid/openinv/listeners/OpenInvPlayerListener.java b/src/main/java/com/lishid/openinv/listeners/OpenInvPlayerListener.java
index 2c479f0..5e1f42b 100644
--- a/src/main/java/com/lishid/openinv/listeners/OpenInvPlayerListener.java
+++ b/src/main/java/com/lishid/openinv/listeners/OpenInvPlayerListener.java
@@ -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");
}
}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index fc8109c..c05d306 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -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.