fix ActionItem Null Error...

Signed-off-by: j502647092 <jtb1@163.com>
pull/1/MERGE
j502647092 2015-07-17 13:47:54 +08:00
parent e82831db0d
commit 6f7cd753c3
1 changed files with 111 additions and 116 deletions

View File

@ -54,7 +54,8 @@ public class ItemsConfig extends ConfigLoader {
Material itemMaterial = Material.matchMaterial(itemInfo[0]);
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;
}
@ -71,7 +72,8 @@ public class ItemsConfig extends ConfigLoader {
String name = null;
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);
@ -133,23 +135,16 @@ public class ItemsConfig extends ConfigLoader {
if (itemStack.getData().equals(soulbindItem.getMaterialData())) {
if (itemStack.hasItemMeta()) {
ItemMeta itemMeta = itemStack.getItemMeta();
if (soulbindItem.getName() != null) {
if (!itemMeta.getDisplayName().contains(soulbindItem.getName())) {
return false;
}
}
if (soulbindItem.getLore() != null && !soulbindItem.getLore().isEmpty()) {
if (itemMeta.hasLore() || !itemMeta.getLore().containsAll(soulbindItem.getLore())) {
return false;
}
}
}
if (itemMeta.getDisplayName().contains(soulbindItem.getName()))
if (soulbindItem.getLore() != null && !soulbindItem.getLore().isEmpty())
if (itemMeta.hasLore()
&& itemMeta.getLore().containsAll(soulbindItem.getLore()))
return true;
}
}
}
}
return false;
}
}