Skip to content

Commit

Permalink
Update to Spigot 1.9.4. Fixes #19.
Browse files Browse the repository at this point in the history
Remove usages of deprecated methods
  • Loading branch information
rutgerkok committed May 12, 2016
1 parent 9c406fe commit dd45c97
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 27 deletions.
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.2</version>
<version>2.4.3</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.9-R0.1-SNAPSHOT</version>
<version>1.9.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.9-R0.1-SNAPSHOT</version>
<version>1.9.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ public ChestDrop getChestDropForPlayer(Player player) {
// Creative mode
return chestDropCreative;
}
if (player.getItemInHand().getEnchantments().containsKey(Enchantment.SILK_TOUCH)) {
ItemStack inHand = player.getInventory().getItemInMainHand();
if (inHand.getEnchantments().containsKey(Enchantment.SILK_TOUCH)) {
// Silk touch
return chestDropSilkTouch;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/nl/rutgerkok/betterenderchest/ChestDrop.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public void drop(BlockBreakEvent event, BetterEnderChest plugin) {
dropCreative(event, plugin);
return;
}
if (event.getPlayer().getItemInHand().getEnchantments().containsKey(Enchantment.SILK_TOUCH)) {
ItemStack inHand = event.getPlayer().getInventory().getItemInMainHand();
if (inHand.getEnchantments().containsKey(Enchantment.SILK_TOUCH)) {
// Silk touch
dropSilkTouch(event);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_9_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_9_R2.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_9_R1.BlockPosition;
import net.minecraft.server.v1_9_R1.MinecraftServer;
import net.minecraft.server.v1_9_R1.NBTBase;
import net.minecraft.server.v1_9_R1.NBTBase.NBTNumber;
import net.minecraft.server.v1_9_R1.NBTCompressedStreamTools;
import net.minecraft.server.v1_9_R1.NBTTagByteArray;
import net.minecraft.server.v1_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R1.NBTTagDouble;
import net.minecraft.server.v1_9_R1.NBTTagInt;
import net.minecraft.server.v1_9_R1.NBTTagIntArray;
import net.minecraft.server.v1_9_R1.NBTTagList;
import net.minecraft.server.v1_9_R1.NBTTagLong;
import net.minecraft.server.v1_9_R1.NBTTagString;
import net.minecraft.server.v1_9_R1.TileEntity;
import net.minecraft.server.v1_9_R1.TileEntityEnderChest;
import net.minecraft.server.v1_9_R2.BlockPosition;
import net.minecraft.server.v1_9_R2.Blocks;
import net.minecraft.server.v1_9_R2.NBTBase;
import net.minecraft.server.v1_9_R2.NBTBase.NBTNumber;
import net.minecraft.server.v1_9_R2.NBTCompressedStreamTools;
import net.minecraft.server.v1_9_R2.NBTTagByteArray;
import net.minecraft.server.v1_9_R2.NBTTagCompound;
import net.minecraft.server.v1_9_R2.NBTTagDouble;
import net.minecraft.server.v1_9_R2.NBTTagInt;
import net.minecraft.server.v1_9_R2.NBTTagIntArray;
import net.minecraft.server.v1_9_R2.NBTTagList;
import net.minecraft.server.v1_9_R2.NBTTagLong;
import net.minecraft.server.v1_9_R2.NBTTagString;
import net.minecraft.server.v1_9_R2.TileEntity;
import net.minecraft.server.v1_9_R2.TileEntityEnderChest;

public class SimpleNMSHandler extends NMSHandler {
static class JSONSimpleTypes {
Expand Down Expand Up @@ -323,7 +323,7 @@ public void closeEnderChest(Location loc) {
BlockPosition blockPos = toBlockPosition(loc);
TileEntity tileEntity = ((CraftWorld) loc.getWorld()).getHandle().getTileEntity(blockPos);
if (tileEntity instanceof TileEntityEnderChest) {
((TileEntityEnderChest) tileEntity).d(); // .close()
((TileEntityEnderChest) tileEntity).e(); // .close()
}
}

Expand Down Expand Up @@ -367,7 +367,7 @@ private int getRows(ChestOwner chestOwner, NBTTagCompound baseTag, NBTTagList in
public boolean isAvailable() {
try {
// Test whether nms access works.
MinecraftServer.getServer();
Blocks.WOOL.getName();
return true;
} catch (Throwable t) {
return false;
Expand Down Expand Up @@ -418,7 +418,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_9_R1.ItemStack.createStack(item)));
CraftItemStack.asCraftMirror(net.minecraft.server.v1_9_R2.ItemStack.createStack(item)));
}

// Return the inventory
Expand All @@ -430,7 +430,7 @@ public void openEnderChest(Location loc) {
BlockPosition blockPos = toBlockPosition(loc);
TileEntity tileEntity = ((CraftWorld) loc.getWorld()).getHandle().getTileEntity(blockPos);
if (tileEntity instanceof TileEntityEnderChest) {
((TileEntityEnderChest) tileEntity).b(); // .open()
((TileEntityEnderChest) tileEntity).d(); // .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_9_R1.NBTTagCompound;
import net.minecraft.server.v1_9_R2.NBTTagCompound;

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

0 comments on commit dd45c97

Please sign in to comment.