From 2b515ca77ddf682b32642ac2e3754d8e13c96b74 Mon Sep 17 00:00:00 2001 From: j502647092 Date: Sat, 24 Oct 2015 18:09:56 +0800 Subject: [PATCH] fix getname null and fix a bug... Signed-off-by: j502647092 --- src/main/java/cn/citycraft/ProtectItem/ProtectItem.java | 6 +++--- .../java/cn/citycraft/ProtectItem/utils/ItemManager.java | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/cn/citycraft/ProtectItem/ProtectItem.java b/src/main/java/cn/citycraft/ProtectItem/ProtectItem.java index bba4992..9222af2 100644 --- a/src/main/java/cn/citycraft/ProtectItem/ProtectItem.java +++ b/src/main/java/cn/citycraft/ProtectItem/ProtectItem.java @@ -19,11 +19,11 @@ public class ProtectItem extends JavaPlugin { public boolean actionCheck(final Player p, final ItemStack i, final ActionType action) { if (itemManager.canAction(i, action)) { - return true; + return false; } else if (itemManager.hasActionPerm(p, i, action)) { - return true; + return false; } - return false; + return true; } public ItemManager getItemManager() { diff --git a/src/main/java/cn/citycraft/ProtectItem/utils/ItemManager.java b/src/main/java/cn/citycraft/ProtectItem/utils/ItemManager.java index 0586f58..9c41225 100644 --- a/src/main/java/cn/citycraft/ProtectItem/utils/ItemManager.java +++ b/src/main/java/cn/citycraft/ProtectItem/utils/ItemManager.java @@ -65,6 +65,9 @@ public class ItemManager { } public String getItemName(final ItemStack i) { + if (i == null || i.getType() == Material.AIR) { + return ""; + } final int dur = i.getDurability(); final String dura = i.getMaxStackSize() != 1 ? dur != 0 ? "_" + dur : "" : ""; return (i.getType().name() + dura).toLowerCase();