Paper/Spigot-API-Patches/0062-Add-getI18NDisplayName-API.patch
Aikar 17b58d00d8
Unwrap Event Exceptions
This was a useless exception wrapper that ends up making
stack traces harder to read as well as the JVM cutting off
the important parts

Nothing catches this exception, so its safe to just get rid
of it and let the REAL exception bubble down
2019-02-23 12:17:41 -05:00

54 lines
2.1 KiB
Diff

From f31c0b3a4d3fe17a7fd04057156089d7db81dc3a 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 3012aec2..63dd1b32 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -145,5 +145,15 @@ public interface ItemFactory {
* @return A potentially Data Converted ItemStack
*/
ItemStack ensureServerConversions(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
+ */
+ String getI18NDisplayName(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 5e8de115..c3cb1247 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -582,5 +582,16 @@ 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
+ */
+ public String getI18NDisplayName() {
+ return Bukkit.getServer().getItemFactory().getI18NDisplayName(this);
+ }
// Paper end
}
--
2.20.1