Check for item meta presence as well

This commit is contained in:
fullwall 2024-05-08 03:21:53 +08:00
parent bb43940a0a
commit 2dd4a2001b

View File

@ -118,7 +118,8 @@ public class CommandTrait extends Trait {
if (!action.isPossible()) {
ItemStack stack = command.itemCost.get(0);
sendErrorMessage(player, CommandTraitError.MISSING_ITEM, null,
stack.getItemMeta().hasDisplayName() ? stack.getItemMeta().getDisplayName()
stack.hasItemMeta() && stack.getItemMeta().hasDisplayName()
? stack.getItemMeta().getDisplayName()
: Util.prettyEnum(stack.getType()),
stack.getAmount());
}
@ -151,7 +152,8 @@ public class CommandTrait extends Trait {
if (!action.isPossible()) {
ItemStack stack = itemRequirements.get(0);
sendErrorMessage(player, CommandTraitError.MISSING_ITEM, null,
stack.getItemMeta().hasDisplayName() ? stack.getItemMeta().getDisplayName()
stack.hasItemMeta() && stack.getItemMeta().hasDisplayName()
? stack.getItemMeta().getDisplayName()
: Util.prettyEnum(stack.getType()),
stack.getAmount());
}