mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-07 23:52:11 -07:00
SPIGOT-7350: Add methods to get hints from EnchantItemEvent
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
@@ -24,16 +24,20 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable {
|
|||||||
private int level;
|
private int level;
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
private final Map<Enchantment, Integer> enchants;
|
private final Map<Enchantment, Integer> enchants;
|
||||||
|
private final Enchantment enchantmentHint;
|
||||||
|
private final int levelHint;
|
||||||
private final Player enchanter;
|
private final Player enchanter;
|
||||||
private final 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<Enchantment, Integer> 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<Enchantment, Integer> enchants, @NotNull final Enchantment enchantmentHint, final int levelHint, final int i) {
|
||||||
super(view);
|
super(view);
|
||||||
this.enchanter = enchanter;
|
this.enchanter = enchanter;
|
||||||
this.table = table;
|
this.table = table;
|
||||||
this.item = item;
|
this.item = item;
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.enchants = new HashMap<Enchantment, Integer>(enchants);
|
this.enchants = new HashMap<Enchantment, Integer>(enchants);
|
||||||
|
this.enchantmentHint = enchantmentHint;
|
||||||
|
this.levelHint = levelHint;
|
||||||
this.cancelled = false;
|
this.cancelled = false;
|
||||||
this.button = i;
|
this.button = i;
|
||||||
}
|
}
|
||||||
@@ -102,6 +106,27 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable {
|
|||||||
return enchants;
|
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.
|
* Which button was pressed to initiate the enchanting.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user