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 5a3e74f90c..1829529c99 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 @@ -24,16 +24,20 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable { private int level; private boolean cancelled; private final Map enchants; + private final Enchantment enchantmentHint; + private final int levelHint; private final Player enchanter; 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) { + 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, @NotNull final Enchantment enchantmentHint, final int levelHint, final int i) { super(view); this.enchanter = enchanter; this.table = table; this.item = item; this.level = level; this.enchants = new HashMap(enchants); + this.enchantmentHint = enchantmentHint; + this.levelHint = levelHint; this.cancelled = false; this.button = i; } @@ -102,6 +106,27 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable { return enchants; } + /** + * Get the {@link Enchantment} that was displayed as a hint to the player + * on the selected enchantment offer. + * + * @return the hinted enchantment + */ + @NotNull + public Enchantment getEnchantmentHint() { + return enchantmentHint; + } + + /** + * Get the level of the enchantment that was displayed as a hint to the + * player on the selected enchantment offer. + * + * @return the level of the hinted enchantment + */ + public int getLevelHint() { + return levelHint; + } + /** * Which button was pressed to initiate the enchanting. *