From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 4 May 2016 23:55:48 -0400 Subject: [PATCH] Add getI18NDisplayName API Gets the Display name as seen in the Client. Currently the server only supports the English language. To override this, You must replace the language file embedded in the server jar. diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java index 3e7f92dc0aea0ea555dd02c50a1102da46fe74c4..16131648915ad4065b82905ab7c799e7554cca2d 100644 --- a/src/main/java/org/bukkit/inventory/ItemFactory.java +++ b/src/main/java/org/bukkit/inventory/ItemFactory.java @@ -235,4 +235,20 @@ public interface ItemFactory { @NotNull net.kyori.adventure.text.Component displayName(@NotNull ItemStack itemStack); // Paper end - Adventure + + // Paper start - add getI18NDisplayName + /** + * Gets the Display name as seen in the Client. + * Currently, the server only supports the English language. To override this, + * You must replace the language file embedded in the server jar. + * + * @param item Item to return Display name of + * @return Display name of Item + * @deprecated {@link ItemStack} implements {@link net.kyori.adventure.translation.Translatable}; use that and + * {@link net.kyori.adventure.text.Component#translatable(net.kyori.adventure.translation.Translatable)} instead. + */ + @Nullable + @Deprecated + String getI18NDisplayName(@Nullable ItemStack item); + // Paper end - add getI18NDisplayName } diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java index e76c847e57f3d32757129d56922862a4202c9d07..8801a49b1ed6e21d9853f1290e52d6f90ce1211f 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java @@ -629,5 +629,20 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public net.kyori.adventure.text.@NotNull Component displayName() { return Bukkit.getServer().getItemFactory().displayName(this); } + + /** + * Gets the Display name as seen in the Client. + * Currently the server only supports the English language. To override this, + * You must replace the language file embedded in the server jar. + * + * @return Display name of Item + * @deprecated {@link ItemStack} implements {@link net.kyori.adventure.translation.Translatable}; use that and + * {@link net.kyori.adventure.text.Component#translatable(net.kyori.adventure.translation.Translatable)} instead. + */ + @Nullable + @Deprecated + public String getI18NDisplayName() { + return Bukkit.getServer().getItemFactory().getI18NDisplayName(this); + } // Paper end }