Skip to content

Commit

Permalink
Update to be compatible with Spigot 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
rutgerkok committed Nov 17, 2016
1 parent b117e28 commit 335cbb8
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 31 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ local.properties
.classpath
.settings/
.loadpath
.idea/
BetterEnderChest.iml

# Locally stored "Eclipse launch configurations"
*.launch
Expand All @@ -44,3 +46,4 @@ Desktop.ini
# Mac crap
.DS_Store


6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>nl.rutgerkok.betterenderchest</groupId>
<artifactId>BetterEnderChest</artifactId>
<version>2.4.5-SNAPSHOT</version>
<version>2.4.5</version>
<name>BetterEnderChest</name>
<description>CraftBukkit plugin that adds functionality for both players and admins to the Ender Chest.</description>
<url>https://github.com/rutgerkok/BetterEnderChest</url>
Expand Down Expand Up @@ -54,13 +54,13 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version>
<version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version>
<version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,32 @@

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_11_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;

import com.google.common.collect.ImmutableMap;

import net.minecraft.server.v1_10_R1.BlockPosition;
import net.minecraft.server.v1_10_R1.Blocks;
import net.minecraft.server.v1_10_R1.NBTBase;
import net.minecraft.server.v1_10_R1.NBTCompressedStreamTools;
import net.minecraft.server.v1_10_R1.NBTTagByte;
import net.minecraft.server.v1_10_R1.NBTTagByteArray;
import net.minecraft.server.v1_10_R1.NBTTagCompound;
import net.minecraft.server.v1_10_R1.NBTTagDouble;
import net.minecraft.server.v1_10_R1.NBTTagFloat;
import net.minecraft.server.v1_10_R1.NBTTagInt;
import net.minecraft.server.v1_10_R1.NBTTagIntArray;
import net.minecraft.server.v1_10_R1.NBTTagList;
import net.minecraft.server.v1_10_R1.NBTTagLong;
import net.minecraft.server.v1_10_R1.NBTTagShort;
import net.minecraft.server.v1_10_R1.NBTTagString;
import net.minecraft.server.v1_10_R1.TileEntity;
import net.minecraft.server.v1_10_R1.TileEntityEnderChest;
import net.minecraft.server.v1_11_R1.BlockPosition;
import net.minecraft.server.v1_11_R1.Blocks;
import net.minecraft.server.v1_11_R1.NBTBase;
import net.minecraft.server.v1_11_R1.NBTCompressedStreamTools;
import net.minecraft.server.v1_11_R1.NBTTagByte;
import net.minecraft.server.v1_11_R1.NBTTagByteArray;
import net.minecraft.server.v1_11_R1.NBTTagCompound;
import net.minecraft.server.v1_11_R1.NBTTagDouble;
import net.minecraft.server.v1_11_R1.NBTTagFloat;
import net.minecraft.server.v1_11_R1.NBTTagInt;
import net.minecraft.server.v1_11_R1.NBTTagIntArray;
import net.minecraft.server.v1_11_R1.NBTTagList;
import net.minecraft.server.v1_11_R1.NBTTagLong;
import net.minecraft.server.v1_11_R1.NBTTagShort;
import net.minecraft.server.v1_11_R1.NBTTagString;
import net.minecraft.server.v1_11_R1.TileEntity;
import net.minecraft.server.v1_11_R1.TileEntityEnderChest;

public class SimpleNMSHandler extends NMSHandler {
static class JSONSimpleTypes {
Expand All @@ -58,7 +58,7 @@ static class JSONSimpleTypes {

/**
* Boxes all the values of the array for consumption by JSONSimple.
*
*
* @param byteArray
* Array to box.
* @return The boxed array.
Expand All @@ -73,7 +73,7 @@ private static final List<Byte> boxBytes(byte[] byteArray) {

/**
* Boxes all the values of the array for consumption by JSONSimple.
*
*
* @param intArray
* Array to box.
* @return The boxed array.
Expand Down Expand Up @@ -179,7 +179,7 @@ private static final Object nbtTagToJavaType(NBTBase tag) throws IOException {
byte value = ((NBTTagByte) tag).g();
return value;
} else if (tag instanceof NBTTagDouble) {
double value = ((NBTTagDouble) tag).h();
double value = ((NBTTagDouble) tag).asDouble();
return value;
} else if (tag instanceof NBTTagFloat) {
float value = ((NBTTagFloat) tag).i();
Expand Down Expand Up @@ -209,7 +209,7 @@ private static final Object nbtTagToJavaType(NBTBase tag) throws IOException {
/**
* Converts the object at the specified position in the list to a Map,
* List, double, float or String.
*
*
* @param tagList
* The list to convert an element from.
* @param position
Expand Down Expand Up @@ -241,7 +241,7 @@ private static final Object tagInNBTListToJavaType(NBTTagList tagList, int posit
/**
* Converts the compound tag to a map. All values in the tag will also
* have their tags converted to String//primitives/maps/Lists.
*
*
* @param tagCompound
* The compound tag.
* @return The map.
Expand All @@ -263,7 +263,7 @@ static final Map<String, Object> toMap(NBTTagCompound tagCompound) throws IOExce
/**
* Turns the given json-formatted string back into a NBTTagCompound.
* Mojangson formatting is also accepted.
*
*
* @param jsonString
* The json string to parse.
* @return The parsed json string.
Expand Down Expand Up @@ -426,7 +426,7 @@ private Inventory loadNBTInventoryFromTag(NBTTagCompound baseTag, ChestOwner che
NBTTagCompound item = inventoryTag.get(i);
int slot = item.getByte("Slot") & 255;
inventory.setItem(slot,
CraftItemStack.asCraftMirror(net.minecraft.server.v1_10_R1.ItemStack.createStack(item)));
CraftItemStack.asCraftMirror(new net.minecraft.server.v1_11_R1.ItemStack(item)));
}

// Return the inventory
Expand All @@ -438,7 +438,7 @@ public void openEnderChest(Location loc) {
BlockPosition blockPos = toBlockPosition(loc);
TileEntity tileEntity = ((CraftWorld) loc.getWorld()).getHandle().getTileEntity(blockPos);
if (tileEntity instanceof TileEntityEnderChest) {
((TileEntityEnderChest) tileEntity).d(); // .open()
((TileEntityEnderChest) tileEntity).a(); // .open()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import net.minecraft.server.v1_10_R1.NBTTagCompound;
import net.minecraft.server.v1_11_R1.NBTTagCompound;

@RunWith(JUnit4.class)
public class TestJSON {
Expand Down

0 comments on commit 335cbb8

Please sign in to comment.