summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunfighterJ <joseph.jenniges@gmail.com>2013-09-17 06:29:03 -0500
committerChris Ward <chris@chrisgward.com>2013-09-17 23:23:45 +1000
commitf72777b5461de01b59b7e20739fed2040ca8d3bd (patch)
treef428dfaff05c2660bdbec4b2779968c074b6afa4
parentbd4a26bb0aad906d0119e71cabfccb97d9c8c2c1 (diff)
downloadEssentials-f72777b5461de01b59b7e20739fed2040ca8d3bd.tar
Essentials-f72777b5461de01b59b7e20739fed2040ca8d3bd.tar.gz
Essentials-f72777b5461de01b59b7e20739fed2040ca8d3bd.tar.lz
Essentials-f72777b5461de01b59b7e20739fed2040ca8d3bd.tar.xz
Essentials-f72777b5461de01b59b7e20739fed2040ca8d3bd.zip
Update ItemStack reference to getTypeId()
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/Kit.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java30
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignTrade.java9
8 files changed, 33 insertions, 32 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index 150c83b68..6c55bb820 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -38,8 +38,6 @@ public class EssentialsPlayerListener implements Listener
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final transient IEssentials ess;
- private static final int AIR = Material.AIR.getId();
- private static final int BED = Material.BED_BLOCK.getId();
public EssentialsPlayerListener(final IEssentials parent)
{
@@ -471,7 +469,7 @@ public class EssentialsPlayerListener implements Listener
switch (event.getAction())
{
case RIGHT_CLICK_BLOCK:
- if (!event.isCancelled() && event.getClickedBlock().getTypeId() == BED && ess.getSettings().getUpdateBedAtDaytime())
+ if (!event.isCancelled() && event.getClickedBlock().getType() == Material.BED_BLOCK && ess.getSettings().getUpdateBedAtDaytime())
{
User player = ess.getUser(event.getPlayer());
if (player.isAuthorized("essentials.sethome.bed"))
@@ -492,7 +490,7 @@ public class EssentialsPlayerListener implements Listener
}
}
case LEFT_CLICK_BLOCK:
- if (event.getItem() != null && event.getItem().getTypeId() != AIR)
+ if (event.getItem() != null && event.getItem().getType() != Material.AIR)
{
final User user = ess.getUser(event.getPlayer());
user.updateActivity(true);
diff --git a/Essentials/src/com/earth2me/essentials/Kit.java b/Essentials/src/com/earth2me/essentials/Kit.java
index 7291594c5..a31ab722e 100644
--- a/Essentials/src/com/earth2me/essentials/Kit.java
+++ b/Essentials/src/com/earth2me/essentials/Kit.java
@@ -14,6 +14,7 @@ import com.earth2me.essentials.utils.DateUtil;
import java.math.BigDecimal;
import java.util.*;
import java.util.logging.Level;
+import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
@@ -187,7 +188,7 @@ public class Kit
final String[] parts = kitItem.split(" +");
final ItemStack parseStack = ess.getItemDb().get(parts[0], parts.length > 1 ? Integer.parseInt(parts[1]) : 1);
- if (parseStack.getTypeId() == 0) {
+ if (parseStack.getType() == Material.AIR) {
continue;
}
diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java
index 9e9fea157..ce1a755cc 100644
--- a/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java
+++ b/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java
@@ -3,6 +3,7 @@ package com.earth2me.essentials.craftbukkit;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Bukkit;
+import org.bukkit.Material;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@@ -94,7 +95,7 @@ public final class InventoryWorkaround
for (int i = 0; i < combined.length; i++)
{
final ItemStack item = combined[i];
- if (item == null || item.getTypeId() == 0)
+ if (item == null || item.getType() == Material.AIR)
{
continue;
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java
index 1cf2fa021..62691fffa 100644
--- a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java
+++ b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java
@@ -321,7 +321,7 @@ public class EssentialsSign
}
final ItemStack item = getItemStack(sign.getLine(itemIndex), 1, ess);
final int amount = Math.min(getIntegerPositive(sign.getLine(amountIndex)), item.getType().getMaxStackSize() * player.getInventory().getSize());
- if (item.getTypeId() == 0 || amount < 1)
+ if (item.getType() == Material.AIR || amount < 1)
{
throw new SignException(_("moreThanZero"));
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
index e116a8fb5..e3046c95b 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
@@ -19,8 +19,8 @@ public class SignBlockListener implements Listener
{
private final transient IEssentials ess;
private final static Logger LOGGER = Logger.getLogger("Minecraft");
- private final static int WALL_SIGN = Material.WALL_SIGN.getId();
- private final static int SIGN_POST = Material.SIGN_POST.getId();
+ private final static Material WALL_SIGN = Material.WALL_SIGN;
+ private final static Material SIGN_POST = Material.SIGN_POST;
public SignBlockListener(IEssentials ess)
{
@@ -51,7 +51,7 @@ public class SignBlockListener implements Listener
return true;
}
- final int mat = block.getTypeId();
+ final Material mat = block.getType();
if (mat == SIGN_POST || mat == WALL_SIGN)
{
final Sign csign = (Sign)block.getState();
@@ -139,16 +139,16 @@ public class SignBlockListener implements Listener
}
final Block against = event.getBlockAgainst();
- if ((against.getTypeId() == WALL_SIGN
- || against.getTypeId() == SIGN_POST)
+ if ((against.getType() == WALL_SIGN
+ || against.getType() == SIGN_POST)
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(against)))
{
event.setCancelled(true);
return;
}
final Block block = event.getBlock();
- if (block.getTypeId() == WALL_SIGN
- || block.getTypeId() == SIGN_POST)
+ if (block.getType() == WALL_SIGN
+ || block.getType() == SIGN_POST)
{
return;
}
@@ -173,8 +173,8 @@ public class SignBlockListener implements Listener
}
final Block block = event.getBlock();
- if (((block.getTypeId() == WALL_SIGN
- || block.getTypeId() == SIGN_POST)
+ if (((block.getType() == WALL_SIGN
+ || block.getType() == SIGN_POST)
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|| EssentialsSign.checkIfBlockBreaksSigns(block))
{
@@ -202,8 +202,8 @@ public class SignBlockListener implements Listener
}
final Block block = event.getBlock();
- if (((block.getTypeId() == WALL_SIGN
- || block.getTypeId() == SIGN_POST)
+ if (((block.getType() == WALL_SIGN
+ || block.getType() == SIGN_POST)
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|| EssentialsSign.checkIfBlockBreaksSigns(block))
{
@@ -232,8 +232,8 @@ public class SignBlockListener implements Listener
for (Block block : event.getBlocks())
{
- if (((block.getTypeId() == WALL_SIGN
- || block.getTypeId() == SIGN_POST)
+ if (((block.getType() == WALL_SIGN
+ || block.getType() == SIGN_POST)
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|| EssentialsSign.checkIfBlockBreaksSigns(block))
{
@@ -264,8 +264,8 @@ public class SignBlockListener implements Listener
if (event.isSticky())
{
final Block block = event.getBlock();
- if (((block.getTypeId() == WALL_SIGN
- || block.getTypeId() == SIGN_POST)
+ if (((block.getType() == WALL_SIGN
+ || block.getType() == SIGN_POST)
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|| EssentialsSign.checkIfBlockBreaksSigns(block))
{
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java b/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
index ab8112f4a..a39ab4d43 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
@@ -30,8 +30,8 @@ public class SignEntityListener implements Listener
for (Block block : event.blockList())
{
- if (((block.getTypeId() == Material.WALL_SIGN.getId()
- || block.getTypeId() == Material.SIGN_POST.getId())
+ if (((block.getType() == Material.WALL_SIGN
+ || block.getType() == Material.SIGN_POST)
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|| EssentialsSign.checkIfBlockBreaksSigns(block))
{
@@ -59,8 +59,8 @@ public class SignEntityListener implements Listener
}
final Block block = event.getBlock();
- if (((block.getTypeId() == Material.WALL_SIGN.getId()
- || block.getTypeId() == Material.SIGN_POST.getId())
+ if (((block.getType() == Material.WALL_SIGN
+ || block.getType() == Material.SIGN_POST)
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|| EssentialsSign.checkIfBlockBreaksSigns(block))
{
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java b/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java
index 4a26f18f0..fc7234ac5 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java
@@ -63,8 +63,8 @@ public class SignPlayerListener implements Listener
return;
}
- final int mat = block.getTypeId();
- if (mat == Material.SIGN_POST.getId() || mat == Material.WALL_SIGN.getId())
+ final Material mat = block.getType();
+ if (mat == Material.SIGN_POST || mat == Material.WALL_SIGN)
{
final String csign = ((Sign)block.getState()).getLine(0);
for (EssentialsSign sign : ess.getSettings().enabledSigns())
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
index 352f72299..05b488d29 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
@@ -8,6 +8,7 @@ import com.earth2me.essentials.Trade.OverflowType;
import com.earth2me.essentials.utils.NumberUtil;
import java.math.BigDecimal;
import java.util.Map;
+import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
//TODO: TL exceptions
@@ -102,7 +103,7 @@ public class SignTrade extends EssentialsSign
{
final Trade trade = getTrade(sign, 2, AmountType.COST, false, ess);
if (trade.getItemStack() != null && player.getItemInHand() != null
- && trade.getItemStack().getTypeId() == player.getItemInHand().getTypeId()
+ && trade.getItemStack().getType() == player.getItemInHand().getType()
&& trade.getItemStack().getDurability() == player.getItemInHand().getDurability()
&& trade.getItemStack().getEnchantments().equals(player.getItemInHand().getEnchantments()))
{
@@ -212,7 +213,7 @@ public class SignTrade extends EssentialsSign
throw new SignException(_("moreThanZero"));
}
if (!(split[1].equalsIgnoreCase("exp") || split[1].equalsIgnoreCase("xp"))
- && getItemStack(split[1], amount, ess).getTypeId() == 0)
+ && getItemStack(split[1], amount, ess).getType() == Material.AIR)
{
throw new SignException(_("moreThanZero"));
}
@@ -235,7 +236,7 @@ public class SignTrade extends EssentialsSign
throw new SignException(_("moreThanZero"));
}
if (!(split[1].equalsIgnoreCase("exp") || split[1].equalsIgnoreCase("xp"))
- && getItemStack(split[1], stackamount, ess).getTypeId() == 0)
+ && getItemStack(split[1], stackamount, ess).getType() == Material.AIR)
{
throw new SignException(_("moreThanZero"));
}
@@ -296,7 +297,7 @@ public class SignTrade extends EssentialsSign
{
amount -= amount % stackamount;
}
- if (notEmpty && (amount < 1 || stackamount < 1 || item.getTypeId() == 0 || amount < stackamount))
+ if (notEmpty && (amount < 1 || stackamount < 1 || item.getType() == Material.AIR || amount < stackamount))
{
throw new SignException(_("tradeSignEmpty"));
}