diff --git a/Plugin/src/main/java/com/gmail/filoghost/chestcommands/internal/icon/ExtendedIcon.java b/Plugin/src/main/java/com/gmail/filoghost/chestcommands/internal/icon/ExtendedIcon.java index e438a18..bd5c13c 100644 --- a/Plugin/src/main/java/com/gmail/filoghost/chestcommands/internal/icon/ExtendedIcon.java +++ b/Plugin/src/main/java/com/gmail/filoghost/chestcommands/internal/icon/ExtendedIcon.java @@ -177,16 +177,20 @@ public class ExtendedIcon extends Icon { } if (requiredItems != null) { + boolean notHasItem = false; for (RequiredItem item : requiredItems) { if (!item.hasItem(player)) { + notHasItem = true; player.sendMessage(ChestCommands.getLang().no_required_item .replace("{material}", MaterialsRegistry.formatMaterial(item.getMaterial())) .replace("{amount}", Integer.toString(item.getAmount())) .replace("{datavalue}", item.hasRestrictiveDataValue() ? Short.toString(item.getDataValue()) : ChestCommands.getLang().any) ); - return closeOnClick; } } + if (notHasItem) { + return closeOnClick; + } } // Take the money and the required item