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

View file

@ -18,25 +18,25 @@ package com.lishid.openinv.internal;
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 com.lishid.openinv.OpenInv;
import net.minecraft.server.v1_10_R1.AxisAlignedBB;
import net.minecraft.server.v1_10_R1.Block;
import net.minecraft.server.v1_10_R1.BlockChest;
import net.minecraft.server.v1_10_R1.BlockChest.Type;
import net.minecraft.server.v1_10_R1.BlockPosition;
import net.minecraft.server.v1_10_R1.Entity;
import net.minecraft.server.v1_10_R1.EntityOcelot;
import net.minecraft.server.v1_10_R1.EntityPlayer;
import net.minecraft.server.v1_10_R1.EnumDirection;
import net.minecraft.server.v1_10_R1.ITileInventory;
import net.minecraft.server.v1_10_R1.InventoryLargeChest;
import net.minecraft.server.v1_10_R1.TileEntity;
import net.minecraft.server.v1_10_R1.TileEntityChest;
import net.minecraft.server.v1_10_R1.World;
import net.minecraft.server.v1_11_R1.AxisAlignedBB;
import net.minecraft.server.v1_11_R1.Block;
import net.minecraft.server.v1_11_R1.BlockChest;
import net.minecraft.server.v1_11_R1.BlockChest.Type;
import net.minecraft.server.v1_11_R1.BlockPosition;
import net.minecraft.server.v1_11_R1.Entity;
import net.minecraft.server.v1_11_R1.EntityOcelot;
import net.minecraft.server.v1_11_R1.EntityPlayer;
import net.minecraft.server.v1_11_R1.EnumDirection;
import net.minecraft.server.v1_11_R1.ITileInventory;
import net.minecraft.server.v1_11_R1.InventoryLargeChest;
import net.minecraft.server.v1_11_R1.TileEntity;
import net.minecraft.server.v1_11_R1.TileEntityChest;
import net.minecraft.server.v1_11_R1.World;
public class AnySilentChest {

View file

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

View file

@ -18,14 +18,14 @@ package com.lishid.openinv.internal;
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.inventory.Inventory;
import com.lishid.openinv.OpenInv;
import com.lishid.openinv.Permissions;
import net.minecraft.server.v1_10_R1.IInventory;
import net.minecraft.server.v1_11_R1.IInventory;
public class InventoryAccess {

View file

@ -20,15 +20,15 @@ import java.util.UUID;
import org.bukkit.Bukkit;
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 com.lishid.openinv.OpenInv;
import com.mojang.authlib.GameProfile;
import net.minecraft.server.v1_10_R1.EntityPlayer;
import net.minecraft.server.v1_10_R1.MinecraftServer;
import net.minecraft.server.v1_10_R1.PlayerInteractManager;
import net.minecraft.server.v1_11_R1.EntityPlayer;
import net.minecraft.server.v1_11_R1.MinecraftServer;
import net.minecraft.server.v1_11_R1.PlayerInteractManager;
public class PlayerDataManager {

View file

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

View file

@ -17,17 +17,19 @@
package com.lishid.openinv.internal;
import java.lang.reflect.Field;
import java.util.List;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftInventory;
import net.minecraft.server.v1_11_R1.NonNullList;
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftHumanEntity;
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.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import net.minecraft.server.v1_10_R1.InventoryEnderChest;
import net.minecraft.server.v1_10_R1.InventorySubcontainer;
import net.minecraft.server.v1_10_R1.ItemStack;
import net.minecraft.server.v1_11_R1.InventoryEnderChest;
import net.minecraft.server.v1_11_R1.InventorySubcontainer;
import net.minecraft.server.v1_11_R1.ItemStack;
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 {
Field itemsField = clazz.getDeclaredField("items");
itemsField.setAccessible(true);

View file

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

View file

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