Add methods to get translation keys
Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
This commit is contained in:
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* The various type of enchantments that may be added to armour or weapons
|
||||
*/
|
||||
public abstract class Enchantment implements Keyed, Translatable {
|
||||
public abstract class Enchantment implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
|
||||
/**
|
||||
* Provides protection against environmental damage
|
||||
*/
|
||||
@@ -324,6 +324,16 @@ public abstract class Enchantment implements Keyed, Translatable {
|
||||
public abstract net.kyori.adventure.text.@NotNull Component displayName(int level);
|
||||
// Paper end
|
||||
|
||||
// Paper start - mark translation key as deprecated
|
||||
/**
|
||||
* @deprecated this method assumes that the enchantments description
|
||||
* always be a translatable component which is not guaranteed.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated(forRemoval = true)
|
||||
public abstract @NotNull String translationKey();
|
||||
// Paper end - mark translation key as deprecated
|
||||
|
||||
/**
|
||||
* Gets the Enchantment at the specified key
|
||||
*
|
||||
|
||||
@@ -26,5 +26,10 @@ public abstract class EnchantmentWrapper extends Enchantment {
|
||||
public net.kyori.adventure.text.Component displayName(int level) {
|
||||
return getEnchantment().displayName(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String translationKey() {
|
||||
return getEnchantment().translationKey();
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user