2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
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
|
2022-04-16 10:29:50 +02:00
|
|
|
index af4a7ce37eb10bab06eadb6583c7894b3ec55ae6..159e5a908b35b84b7fabc36581e093d9aa4c4b67 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
2022-04-16 10:29:50 +02:00
|
|
|
@@ -178,5 +178,19 @@ public interface ItemFactory {
|
2021-06-11 14:02:28 +02:00
|
|
|
*/
|
|
|
|
@NotNull
|
2021-06-12 13:18:01 +02:00
|
|
|
net.kyori.adventure.text.Component displayName(@NotNull ItemStack itemStack);
|
2021-06-11 14:02:28 +02:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 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
|
2022-01-17 01:53:26 +01:00
|
|
|
+ * @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.
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
|
|
|
+ @Nullable
|
2022-01-17 01:53:26 +01:00
|
|
|
+ @Deprecated
|
2021-06-11 14:02:28 +02:00
|
|
|
+ String getI18NDisplayName(@Nullable ItemStack item);
|
|
|
|
// Paper end
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
2023-02-15 23:10:14 +01:00
|
|
|
index 9da047582e9648d84875b6d3c136960bbb97b70e..87f7942082ad943a97058f58c09ea2fe9caf5bfe 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
2023-02-15 23:10:14 +01:00
|
|
|
@@ -618,5 +618,20 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
2021-06-12 13:18:01 +02:00
|
|
|
public @NotNull net.kyori.adventure.text.Component displayName() {
|
|
|
|
return Bukkit.getServer().getItemFactory().displayName(this);
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 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
|
2022-01-17 01:53:26 +01:00
|
|
|
+ * @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.
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
|
|
|
+ @Nullable
|
2022-01-17 01:53:26 +01:00
|
|
|
+ @Deprecated
|
2021-06-11 14:02:28 +02:00
|
|
|
+ public String getI18NDisplayName() {
|
|
|
|
+ return Bukkit.getServer().getItemFactory().getI18NDisplayName(this);
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|