Bring EnchantItemEvent documentation in line with EnchantmentOffer

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2019-09-13 20:14:18 +10:00
parent 33f110a246
commit 85024025e2
2 changed files with 12 additions and 7 deletions

View file

@ -60,8 +60,8 @@ public class EnchantmentOffer {
} }
/** /**
* Gets the cost which is displayed as a number on the right hand side of * Gets the cost (minimum level) which is displayed as a number on the right
* the enchantment offer. * hand side of the enchantment offer.
* *
* @return cost for this enchantment * @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 * Sets the the cost (minimum level) which is displayed as a number on the
* of the enchantment offer. * right hand side of the enchantment offer.
* *
* @param cost cost for this enchantment * @param cost cost for this enchantment
*/ */

View file

@ -2,6 +2,7 @@ package org.bukkit.event.enchantment;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang.Validate;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -24,7 +25,7 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable {
private boolean cancelled; private boolean cancelled;
private final Map<Enchantment,Integer> enchants; private final Map<Enchantment,Integer> enchants;
private final Player enchanter; 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<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, final int i) {
super(view); 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 * @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 * @param level - cost in levels
*/ */
public void setExpLevelCost(int level) { public void setExpLevelCost(int level) {
Validate.isTrue(level > 0, "The cost must be greater than 0!");
this.level = level; this.level = level;
} }