1
0
mirror of https://e.coding.net/circlecloud/Soulbound.git synced 2024-11-22 01:49:09 +00:00

fix ActionItem Null Error...

Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
j502647092 2015-07-17 13:47:54 +08:00
parent e82831db0d
commit 6f7cd753c3

View File

@ -54,7 +54,8 @@ public class ItemsConfig extends ConfigLoader {
Material itemMaterial = Material.matchMaterial(itemInfo[0]); Material itemMaterial = Material.matchMaterial(itemInfo[0]);
if (itemMaterial == null) { if (itemMaterial == null) {
plugin.getLogger().warning("Invalid material name. This item will be skipped. - " + itemInfo[0]); plugin.getLogger().warning(
"Invalid material name. This item will be skipped. - " + itemInfo[0]);
continue; continue;
} }
@ -71,7 +72,8 @@ public class ItemsConfig extends ConfigLoader {
String name = null; String name = null;
if (config.contains("Items." + itemName + ".Name")) { if (config.contains("Items." + itemName + ".Name")) {
name = ChatColor.translateAlternateColorCodes('&', config.getString("Items." + itemName + ".Name")); name = ChatColor.translateAlternateColorCodes('&',
config.getString("Items." + itemName + ".Name"));
} }
SoulbindItem soulbindItem = new SoulbindItem(itemMaterialData, name, lore); SoulbindItem soulbindItem = new SoulbindItem(itemMaterialData, name, lore);
@ -133,23 +135,16 @@ public class ItemsConfig extends ConfigLoader {
if (itemStack.getData().equals(soulbindItem.getMaterialData())) { if (itemStack.getData().equals(soulbindItem.getMaterialData())) {
if (itemStack.hasItemMeta()) { if (itemStack.hasItemMeta()) {
ItemMeta itemMeta = itemStack.getItemMeta(); ItemMeta itemMeta = itemStack.getItemMeta();
if (soulbindItem.getName() != null) { if (soulbindItem.getName() != null) {
if (!itemMeta.getDisplayName().contains(soulbindItem.getName())) { if (itemMeta.getDisplayName().contains(soulbindItem.getName()))
return false; if (soulbindItem.getLore() != null && !soulbindItem.getLore().isEmpty())
} if (itemMeta.hasLore()
} && itemMeta.getLore().containsAll(soulbindItem.getLore()))
if (soulbindItem.getLore() != null && !soulbindItem.getLore().isEmpty()) {
if (itemMeta.hasLore() || !itemMeta.getLore().containsAll(soulbindItem.getLore())) {
return false;
}
}
}
return true; return true;
} }
} }
}
}
return false; return false;
} }
} }