Update to 1.11

This commit is contained in:
Jacob Martin 2016-11-20 10:28:57 -06:00 committed by Lishid
parent 3152605bca
commit b76440ab9a
9 changed files with 100 additions and 102 deletions

11
pom.xml
View file

@ -4,7 +4,7 @@
<groupId>com.lishid</groupId> <groupId>com.lishid</groupId>
<artifactId>openinv</artifactId> <artifactId>openinv</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>2.3.9</version> <version>2.4.0</version>
<name>OpenInv</name> <name>OpenInv</name>
<url>http://dev.bukkit.org/bukkit-plugins/openinv/</url> <url>http://dev.bukkit.org/bukkit-plugins/openinv/</url>
@ -20,17 +20,10 @@
</repositories> </repositories>
<dependencies> <dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.10-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
<version>1.10-R0.1-SNAPSHOT</version> <version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View file

@ -18,25 +18,25 @@ package com.lishid.openinv.internal;
import java.util.Iterator; import java.util.Iterator;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.lishid.openinv.OpenInv; import com.lishid.openinv.OpenInv;
import net.minecraft.server.v1_10_R1.AxisAlignedBB; import net.minecraft.server.v1_11_R1.AxisAlignedBB;
import net.minecraft.server.v1_10_R1.Block; import net.minecraft.server.v1_11_R1.Block;
import net.minecraft.server.v1_10_R1.BlockChest; import net.minecraft.server.v1_11_R1.BlockChest;
import net.minecraft.server.v1_10_R1.BlockChest.Type; import net.minecraft.server.v1_11_R1.BlockChest.Type;
import net.minecraft.server.v1_10_R1.BlockPosition; import net.minecraft.server.v1_11_R1.BlockPosition;
import net.minecraft.server.v1_10_R1.Entity; import net.minecraft.server.v1_11_R1.Entity;
import net.minecraft.server.v1_10_R1.EntityOcelot; import net.minecraft.server.v1_11_R1.EntityOcelot;
import net.minecraft.server.v1_10_R1.EntityPlayer; import net.minecraft.server.v1_11_R1.EntityPlayer;
import net.minecraft.server.v1_10_R1.EnumDirection; import net.minecraft.server.v1_11_R1.EnumDirection;
import net.minecraft.server.v1_10_R1.ITileInventory; import net.minecraft.server.v1_11_R1.ITileInventory;
import net.minecraft.server.v1_10_R1.InventoryLargeChest; import net.minecraft.server.v1_11_R1.InventoryLargeChest;
import net.minecraft.server.v1_10_R1.TileEntity; import net.minecraft.server.v1_11_R1.TileEntity;
import net.minecraft.server.v1_10_R1.TileEntityChest; import net.minecraft.server.v1_11_R1.TileEntityChest;
import net.minecraft.server.v1_10_R1.World; import net.minecraft.server.v1_11_R1.World;
public class AnySilentChest { public class AnySilentChest {

View file

@ -4,8 +4,8 @@ import java.util.Iterator;
import com.google.common.collect.Iterators; import com.google.common.collect.Iterators;
import net.minecraft.server.v1_10_R1.EnumDirection; import net.minecraft.server.v1_11_R1.EnumDirection;
import net.minecraft.server.v1_10_R1.EnumDirection.EnumDirectionLimit; import net.minecraft.server.v1_11_R1.EnumDirection.EnumDirectionLimit;
public enum EnumDirectionList implements Iterable<EnumDirection> { public enum EnumDirectionList implements Iterable<EnumDirection> {

View file

@ -18,14 +18,14 @@ package com.lishid.openinv.internal;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftInventory; import org.bukkit.craftbukkit.v1_11_R1.inventory.CraftInventory;
import org.bukkit.entity.HumanEntity; import org.bukkit.entity.HumanEntity;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import com.lishid.openinv.OpenInv; import com.lishid.openinv.OpenInv;
import com.lishid.openinv.Permissions; import com.lishid.openinv.Permissions;
import net.minecraft.server.v1_10_R1.IInventory; import net.minecraft.server.v1_11_R1.IInventory;
public class InventoryAccess { public class InventoryAccess {

View file

@ -20,15 +20,15 @@ import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.craftbukkit.v1_10_R1.CraftServer; import org.bukkit.craftbukkit.v1_11_R1.CraftServer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.lishid.openinv.OpenInv; import com.lishid.openinv.OpenInv;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.minecraft.server.v1_10_R1.EntityPlayer; import net.minecraft.server.v1_11_R1.EntityPlayer;
import net.minecraft.server.v1_10_R1.MinecraftServer; import net.minecraft.server.v1_11_R1.MinecraftServer;
import net.minecraft.server.v1_10_R1.PlayerInteractManager; import net.minecraft.server.v1_11_R1.PlayerInteractManager;
public class PlayerDataManager { public class PlayerDataManager {

View file

@ -3,18 +3,18 @@ package com.lishid.openinv.internal;
import java.util.List; import java.util.List;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftHumanEntity; import org.bukkit.craftbukkit.v1_11_R1.entity.CraftHumanEntity;
import org.bukkit.entity.HumanEntity; import org.bukkit.entity.HumanEntity;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
import net.minecraft.server.v1_10_R1.ChestLock; import net.minecraft.server.v1_11_R1.ChestLock;
import net.minecraft.server.v1_10_R1.Container; import net.minecraft.server.v1_11_R1.Container;
import net.minecraft.server.v1_10_R1.ContainerChest; import net.minecraft.server.v1_11_R1.ContainerChest;
import net.minecraft.server.v1_10_R1.EntityHuman; import net.minecraft.server.v1_11_R1.EntityHuman;
import net.minecraft.server.v1_10_R1.IChatBaseComponent; import net.minecraft.server.v1_11_R1.IChatBaseComponent;
import net.minecraft.server.v1_10_R1.ITileInventory; import net.minecraft.server.v1_11_R1.ITileInventory;
import net.minecraft.server.v1_10_R1.ItemStack; import net.minecraft.server.v1_11_R1.ItemStack;
import net.minecraft.server.v1_10_R1.PlayerInventory; import net.minecraft.server.v1_11_R1.PlayerInventory;
public class SilentInventory implements ITileInventory { public class SilentInventory implements ITileInventory {
@ -25,8 +25,9 @@ public class SilentInventory implements ITileInventory {
} }
@Override @Override
public boolean x_() { public boolean isLocked()
return inv.x_(); {
return inv.isLocked();
} }
@Override @Override
@ -35,8 +36,8 @@ public class SilentInventory implements ITileInventory {
} }
@Override @Override
public ChestLock y_() { public ChestLock getLock() {
return inv.y_(); return inv.getLock();
} }
@Override @Override
@ -44,6 +45,11 @@ public class SilentInventory implements ITileInventory {
return inv.getSize(); return inv.getSize();
} }
@Override
public boolean w_() {
return inv.w_();
}
@Override @Override
public ItemStack getItem(int i) { public ItemStack getItem(int i) {
return inv.getItem(i); return inv.getItem(i);
@ -105,17 +111,17 @@ public class SilentInventory implements ITileInventory {
} }
@Override @Override
public int g() { public int h() {
return inv.g(); return inv.h();
} }
@Override @Override
public void l() { public void clear() {
inv.l(); inv.clear();
} }
@Override @Override
public ItemStack[] getContents() { public List<ItemStack> getContents() {
return inv.getContents(); return inv.getContents();
} }

View file

@ -17,17 +17,19 @@
package com.lishid.openinv.internal; package com.lishid.openinv.internal;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.List;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftHumanEntity; import net.minecraft.server.v1_11_R1.NonNullList;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_11_R1.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftInventory; import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_11_R1.inventory.CraftInventory;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
import net.minecraft.server.v1_10_R1.InventoryEnderChest; import net.minecraft.server.v1_11_R1.InventoryEnderChest;
import net.minecraft.server.v1_10_R1.InventorySubcontainer; import net.minecraft.server.v1_11_R1.InventorySubcontainer;
import net.minecraft.server.v1_10_R1.ItemStack; import net.minecraft.server.v1_11_R1.ItemStack;
public class SpecialEnderChest extends InventorySubcontainer { public class SpecialEnderChest extends InventorySubcontainer {
@ -54,7 +56,7 @@ public class SpecialEnderChest extends InventorySubcontainer {
} }
} }
private void reflectContents(Class clazz, InventorySubcontainer enderChest, ItemStack[] items) { private void reflectContents(Class clazz, InventorySubcontainer enderChest, List<ItemStack> items) {
try { try {
Field itemsField = clazz.getDeclaredField("items"); Field itemsField = clazz.getDeclaredField("items");
itemsField.setAccessible(true); itemsField.setAccessible(true);

View file

@ -18,23 +18,19 @@ package com.lishid.openinv.internal;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftHumanEntity; import net.minecraft.server.v1_11_R1.*;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_11_R1.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftInventory; import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_11_R1.inventory.CraftInventory;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import net.minecraft.server.v1_10_R1.ContainerUtil;
import net.minecraft.server.v1_10_R1.EntityHuman;
import net.minecraft.server.v1_10_R1.ItemStack;
import net.minecraft.server.v1_10_R1.PlayerInventory;
public class SpecialPlayerInventory extends PlayerInventory { public class SpecialPlayerInventory extends PlayerInventory {
private final CraftInventory inventory = new CraftInventory(this); private final CraftInventory inventory = new CraftInventory(this);
private final ItemStack[] extra = new ItemStack[4]; private final NonNullList<ItemStack> extra = NonNullList.a();
private CraftPlayer owner; private CraftPlayer owner;
private ItemStack[][] arrays; private NonNullList<ItemStack>[] arrays;
private boolean playerOnline; private boolean playerOnline;
public SpecialPlayerInventory(Player p, boolean online) { public SpecialPlayerInventory(Player p, boolean online) {
@ -67,7 +63,8 @@ public class SpecialPlayerInventory extends PlayerInventory {
e.printStackTrace(); e.printStackTrace();
} }
arrays = new ItemStack[][] { this.items, this.armor, this.extraSlots, this.extra }; //noinspection unchecked
arrays = new NonNullList[] { this.items, this.armor, this.extraSlots, this.extra };
} }
private void linkInventory(PlayerInventory inventory) { private void linkInventory(PlayerInventory inventory) {
@ -109,11 +106,11 @@ public class SpecialPlayerInventory extends PlayerInventory {
} }
@Override @Override
public ItemStack[] getContents() { public NonNullList<ItemStack> getContents() {
ItemStack[] contents = new ItemStack[getSize()]; NonNullList<ItemStack> contents = NonNullList.a();
System.arraycopy(this.items, 0, contents, 0, this.items.length); contents.addAll(this.items);
System.arraycopy(this.armor, 0, contents, this.items.length, this.armor.length); contents.addAll(this.armor);
System.arraycopy(this.extraSlots, 0, contents, this.items.length + this.armor.length, this.extraSlots.length); contents.addAll(this.extraSlots);
return contents; return contents;
} }
@ -124,19 +121,19 @@ public class SpecialPlayerInventory extends PlayerInventory {
@Override @Override
public ItemStack getItem(int i) { public ItemStack getItem(int i) {
ItemStack[] is = null; NonNullList<ItemStack> is = null;
ItemStack[][] contents = this.arrays; NonNullList<ItemStack>[] contents = this.arrays;
int j = contents.length; int j = contents.length;
for (int k = 0; k < j; ++k) { for (int k = 0; k < j; ++k) {
ItemStack[] is2 = contents[k]; NonNullList<ItemStack> is2 = contents[k];
if (i < is2.length) { if (i < is2.size()) {
is = is2; is = is2;
break; break;
} }
i -= is2.length; i -= is2.size();
} }
if (is == this.items) { if (is == this.items) {
@ -149,24 +146,24 @@ public class SpecialPlayerInventory extends PlayerInventory {
// Do nothing // Do nothing
} }
return is == null ? null : is[i]; return is == null ? ItemStack.a : is.get(i);
} }
@Override @Override
public ItemStack splitStack(int i, int j) { public ItemStack splitStack(int i, int j) {
ItemStack[] is = null; NonNullList<ItemStack> is = null;
ItemStack[][] contents = this.arrays; NonNullList<ItemStack>[] contents = this.arrays;
int k = contents.length; int k = contents.length;
for (int l = 0; l < k; ++l) { for (int l = 0; l < k; ++l) {
ItemStack[] is2 = contents[l]; NonNullList<ItemStack> is2 = contents[l];
if (i < is2.length) { if (i < is2.size()) {
is = is2; is = is2;
break; break;
} }
i -= is2.length; i -= is2.size();
} }
if (is == this.items) { if (is == this.items) {
@ -179,27 +176,27 @@ public class SpecialPlayerInventory extends PlayerInventory {
// Do nothing // Do nothing
} }
return is != null && is[i] != null ? ContainerUtil.a(is, i, j) : null; return is != null && !is.get(i).isEmpty() ? ContainerUtil.a(is, i, j) : ItemStack.a;
} }
@Override @Override
public ItemStack splitWithoutUpdate(int i) { public ItemStack splitWithoutUpdate(int i) {
ItemStack[] is = null; NonNullList<ItemStack> is = null;
ItemStack[][] contents = this.arrays; NonNullList<ItemStack>[] contents = this.arrays;
int j = contents.length; int j = contents.length;
for (int object = 0; object < j; ++object) { for (int object = 0; object < j; ++object) {
ItemStack[] is2 = contents[object]; NonNullList<ItemStack> is2 = contents[object];
if (i < is2.length) { if (i < is2.size()) {
is = is2; is = is2;
break; break;
} }
i -= is2.length; i -= is2.size();
} }
if (is != null && is[i] != null) { if (is != null && !is.get(i).isEmpty()) {
if (is == this.items) { if (is == this.items) {
i = getReversedItemSlotNum(i); i = getReversedItemSlotNum(i);
} else if (is == this.armor) { } else if (is == this.armor) {
@ -210,29 +207,29 @@ public class SpecialPlayerInventory extends PlayerInventory {
// Do nothing // Do nothing
} }
Object object = is[i]; Object object = is.get(i);
is[i] = null; is.set(i, ItemStack.a);
return (ItemStack) object; return (ItemStack) object;
} else { } else {
return null; return ItemStack.a;
} }
} }
@Override @Override
public void setItem(int i, ItemStack itemStack) { public void setItem(int i, ItemStack itemStack) {
ItemStack[] is = null; NonNullList<ItemStack> is = null;
ItemStack[][] contents = this.arrays; NonNullList<ItemStack>[] contents = this.arrays;
int j = contents.length; int j = contents.length;
for (int k = 0; k < j; ++k) { for (int k = 0; k < j; ++k) {
ItemStack[] is2 = contents[k]; NonNullList<ItemStack> is2 = contents[k];
if (i < is2.length) { if (i < is2.size()) {
is = is2; is = is2;
break; break;
} }
i -= is2.length; i -= is2.size();
} }
if (is != null) { if (is != null) {
@ -244,10 +241,10 @@ public class SpecialPlayerInventory extends PlayerInventory {
// Do nothing // Do nothing
} else if (is == this.extra) { } else if (is == this.extra) {
owner.getHandle().drop(itemStack, true); owner.getHandle().drop(itemStack, true);
itemStack = null; itemStack = ItemStack.a;
} }
is[i] = itemStack; is.set(i, itemStack);
owner.getHandle().defaultContainer.b(); owner.getHandle().defaultContainer.b();
} }

View file

@ -1,6 +1,6 @@
name: OpenInv name: OpenInv
main: com.lishid.openinv.OpenInv main: com.lishid.openinv.OpenInv
version: 2.3.9 version: 2.4.0
author: lishid author: lishid
authors: [ShadowRanger] authors: [ShadowRanger]
description: > description: >