2020-01-22 03:06:28 +00:00
|
|
|
From 3f4a17835ea5512030e329f447171e75323f9bf9 Mon Sep 17 00:00:00 2001
|
2017-07-27 03:44:09 +00:00
|
|
|
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
|
2020-01-22 02:02:07 +00:00
|
|
|
index bb3f7cdc..3cada348 100644
|
2017-07-27 03:44:09 +00:00
|
|
|
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
2019-03-20 00:28:15 +00:00
|
|
|
@@ -153,5 +153,16 @@ public interface ItemFactory {
|
2017-07-27 03:44:09 +00:00
|
|
|
*/
|
2019-03-20 00:28:15 +00:00
|
|
|
@NotNull
|
|
|
|
ItemStack ensureServerConversions(@NotNull ItemStack item);
|
2017-07-27 03:44:09 +00: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
|
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @Nullable
|
|
|
|
+ String getI18NDisplayName(@Nullable ItemStack item);
|
2017-07-27 03:44:09 +00:00
|
|
|
// Paper end
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
2020-01-22 03:06:28 +00:00
|
|
|
index ca6d1233..8adf9399 100644
|
2017-07-27 03:44:09 +00:00
|
|
|
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
2020-01-22 03:06:28 +00:00
|
|
|
@@ -609,5 +609,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
2017-07-27 03:44:09 +00:00
|
|
|
public ItemStack ensureServerConversions() {
|
|
|
|
return Bukkit.getServer().getItemFactory().ensureServerConversions(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
|
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ @Nullable
|
2017-07-27 03:44:09 +00:00
|
|
|
+ public String getI18NDisplayName() {
|
|
|
|
+ return Bukkit.getServer().getItemFactory().getI18NDisplayName(this);
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|
|
|
|
--
|
2020-01-22 03:06:28 +00:00
|
|
|
2.25.0
|
2017-07-27 03:44:09 +00:00
|
|
|
|