mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-05 16:49:39 +00:00
SPIGOT-7350: Add methods to get hints from EnchantItemEvent
This commit is contained in:
parent
950f83e3f7
commit
54e8ec7b47
1 changed files with 26 additions and 1 deletions
|
@ -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.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue