Fix min ItemStack amount check for asHoverEvent (#12505)

This commit is contained in:
Pedro 2025-05-01 10:00:23 -04:00 committed by GitHub
parent 835b955913
commit c9411bfb83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -216,7 +216,7 @@ public final class CraftItemFactory implements ItemFactory {
@Override
public net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowItem> asHoverEvent(final ItemStack item, final java.util.function.UnaryOperator<net.kyori.adventure.text.event.HoverEvent.ShowItem> op) {
Preconditions.checkArgument(item.getAmount() > 1 && item.getAmount() <= 99, "ItemStack amount must be between 1 and 99 but was %s", item.getAmount());
Preconditions.checkArgument(item.getAmount() > 0 && item.getAmount() <= Item.ABSOLUTE_MAX_STACK_SIZE, "ItemStack amount must be between 1 and %s but was %s", Item.ABSOLUTE_MAX_STACK_SIZE, item.getAmount());
return net.kyori.adventure.text.event.HoverEvent.showItem(op.apply(
net.kyori.adventure.text.event.HoverEvent.ShowItem.showItem(
item.getType().getKey(),