Adventure

Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Yannick Lamprecht <yannicklamprecht@live.de>
This commit is contained in:
Riley Park
2021-01-29 17:21:55 +01:00
parent 8888031206
commit 15081a5912
70 changed files with 3298 additions and 160 deletions

View File

@@ -310,6 +310,19 @@ public abstract class Enchantment implements Keyed, Translatable {
* @return True if the enchantment may be applied, otherwise False
*/
public abstract boolean canEnchantItem(@NotNull ItemStack item);
// Paper start
/**
* Get the name of the enchantment with its applied level.
* <p>
* If the given {@code level} is either less than the {@link #getStartLevel()} or greater than the {@link #getMaxLevel()},
* the level may not be shown in the numeral format one may otherwise expect.
* </p>
*
* @param level the level of the enchantment to show
* @return the name of the enchantment with {@code level} applied
*/
public abstract net.kyori.adventure.text.@NotNull Component displayName(int level);
// Paper end
/**
* Gets the Enchantment at the specified key

View File

@@ -20,4 +20,11 @@ public abstract class EnchantmentWrapper extends Enchantment {
public Enchantment getEnchantment() {
return this;
}
// Paper start
@NotNull
@Override
public net.kyori.adventure.text.Component displayName(int level) {
return getEnchantment().displayName(level);
}
// Paper end
}