#979: Add more translation keys

By: Miles Holder <mwholder2005@gmail.com>
This commit is contained in:
Bukkit/Spigot 2024-03-17 10:26:51 +11:00
parent 016f4cc0da
commit 6ba05011fa
6 changed files with 19 additions and 5 deletions

View File

@ -94,6 +94,8 @@ public interface UnsafeValues {
String getTranslationKey(ItemStack itemStack); String getTranslationKey(ItemStack itemStack);
String getTranslationKey(Attribute attribute);
@Nullable @Nullable
FeatureFlag getFeatureFlag(@NotNull NamespacedKey key); FeatureFlag getFeatureFlag(@NotNull NamespacedKey key);

View File

@ -1,13 +1,15 @@
package org.bukkit.attribute; package org.bukkit.attribute;
import org.bukkit.Bukkit;
import org.bukkit.Keyed; import org.bukkit.Keyed;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.Translatable;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
* Types of attributes which may be present on an {@link Attributable}. * Types of attributes which may be present on an {@link Attributable}.
*/ */
public enum Attribute implements Keyed { public enum Attribute implements Keyed, Translatable {
/** /**
* Maximum health of an Entity. * Maximum health of an Entity.
@ -77,4 +79,10 @@ public enum Attribute implements Keyed {
public NamespacedKey getKey() { public NamespacedKey getKey() {
return key; return key;
} }
@NotNull
@Override
public String getTranslationKey() {
return Bukkit.getUnsafe().getTranslationKey(this);
}
} }

View File

@ -5,6 +5,7 @@ import com.google.common.collect.Lists;
import org.bukkit.Keyed; import org.bukkit.Keyed;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.Registry; import org.bukkit.Registry;
import org.bukkit.Translatable;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -13,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
/** /**
* The various type of enchantments that may be added to armour or weapons * The various type of enchantments that may be added to armour or weapons
*/ */
public abstract class Enchantment implements Keyed { public abstract class Enchantment implements Keyed, Translatable {
/** /**
* Provides protection against environmental damage * Provides protection against environmental damage
*/ */

View File

@ -4,11 +4,12 @@ import org.bukkit.Keyed;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.Registry; import org.bukkit.Registry;
import org.bukkit.Translatable;
/** /**
* Represents a material that may be used in an {@link ArmorTrim}. * Represents a material that may be used in an {@link ArmorTrim}.
*/ */
public interface TrimMaterial extends Keyed { public interface TrimMaterial extends Keyed, Translatable {
/** /**
* {@link Material#QUARTZ}. * {@link Material#QUARTZ}.

View File

@ -4,11 +4,12 @@ import org.bukkit.Keyed;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.Registry; import org.bukkit.Registry;
import org.bukkit.Translatable;
/** /**
* Represents a pattern that may be used in an {@link ArmorTrim}. * Represents a pattern that may be used in an {@link ArmorTrim}.
*/ */
public interface TrimPattern extends Keyed { public interface TrimPattern extends Keyed, Translatable {
/** /**
* {@link Material#SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE}. * {@link Material#SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE}.

View File

@ -8,6 +8,7 @@ import org.bukkit.Color;
import org.bukkit.Keyed; import org.bukkit.Keyed;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.Registry; import org.bukkit.Registry;
import org.bukkit.Translatable;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -15,7 +16,7 @@ import org.jetbrains.annotations.Nullable;
/** /**
* Represents a type of potion and its effect on an entity. * Represents a type of potion and its effect on an entity.
*/ */
public abstract class PotionEffectType implements Keyed { public abstract class PotionEffectType implements Keyed, Translatable {
private static final BiMap<Integer, PotionEffectType> ID_MAP = HashBiMap.create(); private static final BiMap<Integer, PotionEffectType> ID_MAP = HashBiMap.create();
/** /**