Ensure ItemFlag is valid and not null, fixes #560

This commit is contained in:
BuildTools 2018-12-06 16:17:15 -05:00
parent 6c9d019296
commit d54d50725c

View File

@ -257,7 +257,13 @@ public class ItemUtil {
}
if (flags[0] != null && flags[0].toString() != "") {
for (ItemFlag flag : flags) {
meta.addItemFlags(flag);
if (flag != null) {
try {
meta.addItemFlags(flag);
} catch (NullPointerException npe) {
Bukkit.getLogger().severe(flag + " is not a valid ItemFlag");
}
}
}
}
if (stack.getType().equals(Material.ENCHANTED_BOOK)) {