Add methods to get translation keys

Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
This commit is contained in:
Jake Potrebic
2020-08-11 19:17:46 +02:00
parent a3e3ba54a0
commit f610d0b477
18 changed files with 186 additions and 30 deletions

View File

@@ -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
*

View File

@@ -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
}