diff --git a/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentOffer.java b/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentOffer.java index e99ed64451..da9fc59caa 100644 --- a/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentOffer.java +++ b/paper-api/src/main/java/org/bukkit/enchantments/EnchantmentOffer.java @@ -60,8 +60,8 @@ public class EnchantmentOffer { } /** - * Gets the cost which is displayed as a number on the right hand side of - * the enchantment offer. + * Gets the cost (minimum level) which is displayed as a number on the right + * hand side of the enchantment offer. * * @return cost for this enchantment */ @@ -70,8 +70,8 @@ public class EnchantmentOffer { } /** - * Sets the the cost which is displayed as a number on the right hand side - * of the enchantment offer. + * Sets the the cost (minimum level) which is displayed as a number on the + * right hand side of the enchantment offer. * * @param cost cost for this enchantment */ diff --git a/paper-api/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java b/paper-api/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java index 4ab67a55e4..f58e4599b7 100644 --- a/paper-api/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/enchantment/EnchantItemEvent.java @@ -2,6 +2,7 @@ package org.bukkit.event.enchantment; import java.util.HashMap; import java.util.Map; +import org.apache.commons.lang.Validate; import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; @@ -24,7 +25,7 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable { private boolean cancelled; private final Map enchants; private final Player enchanter; - private int button; + private final int button; public EnchantItemEvent(@NotNull final Player enchanter, @NotNull final InventoryView view, @NotNull final Block table, @NotNull final ItemStack item, final int level, @NotNull final Map enchants, final int i) { super(view); @@ -68,7 +69,8 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable { } /** - * Get cost in exp levels of the enchantment + * Gets the cost (minimum level) which is displayed as a number on the right + * hand side of the enchantment offer. * * @return experience level cost */ @@ -77,11 +79,14 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable { } /** - * Set cost in exp levels of the enchantment + * Sets the the cost (minimum level) which is displayed as a number on the + * right hand side of the enchantment offer. * * @param level - cost in levels */ public void setExpLevelCost(int level) { + Validate.isTrue(level > 0, "The cost must be greater than 0!"); + this.level = level; }