Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
53 Zeilen
2.2 KiB
Diff
53 Zeilen
2.2 KiB
Diff
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
|
|
index bb3f7cdc13dc015f88d3eaf5997f391528599d2a..3cada34873e6da92363c8d920f3bbbd0670a32e0 100644
|
|
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
|
@@ -153,5 +153,16 @@ public interface ItemFactory {
|
|
*/
|
|
@NotNull
|
|
ItemStack ensureServerConversions(@NotNull ItemStack item);
|
|
+
|
|
+ /**
|
|
+ * 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
|
|
+ */
|
|
+ @Nullable
|
|
+ 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
|
|
index 07aa65d1a2056422b7b5ec98be970d5b064f3b81..e9ba311522a50572e6f1cb4554ba8e24a55cbb8a 100644
|
|
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
@@ -609,5 +609,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
|
|
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
|
|
+ */
|
|
+ @Nullable
|
|
+ public String getI18NDisplayName() {
|
|
+ return Bukkit.getServer().getItemFactory().getI18NDisplayName(this);
|
|
+ }
|
|
// Paper end
|
|
}
|