Skip to content

Commit

Permalink
Make command item missing-item error use display name if present
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed May 7, 2024
1 parent 28e2e87 commit bb43940
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main/src/main/java/net/citizensnpcs/trait/CommandTrait.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ private Transaction chargeCommandCosts(Player player, Hand hand, NPCCommand comm
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);
Expand Down Expand Up @@ -148,7 +150,9 @@ private Transaction chargeGlobalCommandCosts(Player player, Hand hand) {
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);
Expand Down

0 comments on commit bb43940

Please sign in to comment.