Paper/Spigot-Server-Patches/0226-Implement-getI18NDisplayName.patch
Shane Freeder 1875fb559b
Update metrics to support java 9
http://openjdk.java.net/jeps/223
Java decided to change their versioning scheme and in doing so modified the
java.version system property to return $major[.$minor][.$secuity][-ea], as
opposed to 1.$major.0_$identifier we can handle pre-9 by checking if the "major"
is equal to "1", otherwise, 9+

of course, it really wouldn't be all that simple if they didn't add a quirk, now would it.
valid strings for the major may potentially include values such as -ea to deannotate a pre release
2017-09-26 06:04:00 +01:00

36 lines
1.3 KiB
Diff

From 11d553a3a2d83a47dc49929978682109d43ecd97 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 May 2016 23:59:38 -0400
Subject: [PATCH] Implement 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.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index eb6987338..c2f26577c 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -200,5 +200,18 @@ public final class CraftItemFactory implements ItemFactory {
public ItemStack ensureServerConversions(ItemStack item) {
return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item));
}
+
+ @Override
+ public String getI18NDisplayName(ItemStack item) {
+ net.minecraft.server.ItemStack nms = null;
+ if (item instanceof CraftItemStack) {
+ nms = ((CraftItemStack) item).handle;
+ }
+ if (nms == null) {
+ nms = CraftItemStack.asNMSCopy(item);
+ }
+
+ return nms != null ? nms.getName() : null;
+ }
// Paper end
}
--
2.14.1