From bb43940a0acd604882c093b6030bed354dda8ab3 Mon Sep 17 00:00:00 2001 From: fullwall Date: Wed, 8 May 2024 03:19:55 +0800 Subject: [PATCH] Make command item missing-item error use display name if present --- .../main/java/net/citizensnpcs/trait/CommandTrait.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/trait/CommandTrait.java b/main/src/main/java/net/citizensnpcs/trait/CommandTrait.java index c11f979f1..68e5a8395 100644 --- a/main/src/main/java/net/citizensnpcs/trait/CommandTrait.java +++ b/main/src/main/java/net/citizensnpcs/trait/CommandTrait.java @@ -117,7 +117,9 @@ public class CommandTrait extends Trait { Transaction action = new ItemAction(command.itemCost).take(player, 1); if (!action.isPossible()) { ItemStack stack = command.itemCost.get(0); - sendErrorMessage(player, CommandTraitError.MISSING_ITEM, null, Util.prettyEnum(stack.getType()), + sendErrorMessage(player, CommandTraitError.MISSING_ITEM, null, + stack.getItemMeta().hasDisplayName() ? stack.getItemMeta().getDisplayName() + : Util.prettyEnum(stack.getType()), stack.getAmount()); } txns.add(action); @@ -148,7 +150,9 @@ public class CommandTrait extends Trait { Transaction action = new ItemAction(itemRequirements).take(player, 1); if (!action.isPossible()) { ItemStack stack = itemRequirements.get(0); - sendErrorMessage(player, CommandTraitError.MISSING_ITEM, null, Util.prettyEnum(stack.getType()), + sendErrorMessage(player, CommandTraitError.MISSING_ITEM, null, + stack.getItemMeta().hasDisplayName() ? stack.getItemMeta().getDisplayName() + : Util.prettyEnum(stack.getType()), stack.getAmount()); } txns.add(action);