1
mirror of https://github.com/CarmJos/ScriptItems synced 2026-07-15 07:21:23 +08:00

fix(null): 修复物品可能为空导致的报错问题

This commit is contained in:
2023-02-08 20:11:00 +08:00
parent 629bdbeac9
commit 2259965496
5 changed files with 67 additions and 51 deletions
@@ -118,8 +118,9 @@ public class ItemsManager {
return new ScriptItem(UUID.fromString(itemUUID), settings, item);
}
public boolean isScriptItem(ItemStack item) {
return item.hasItemMeta() && item.getItemMeta() != null
public boolean isScriptItem(@Nullable ItemStack item) {
return item != null && item.getType() != Material.AIR
&& item.hasItemMeta() && item.getItemMeta() != null
&& item.getItemMeta().getCustomTagContainer().hasCustomTag(idKey, ItemTagType.STRING);
}