Paper/Spigot-Server-Patches/0222-Implement-getI18NDisplayName.patch
Zach Brown 6f2009754d
Stop explicitly blocking Vanilla Method Profiler
At the time this was re-added, there was concern around how the JIT
would handle the system property that enabled it.

This shouldn't be a problem, and as such we no longer need to block
access to it.

The Vanilla Method Profiler will not provide much to most users however
there is no harm in providing it as an option. For most users, the
recommended and supported method for determining performance issues with
Paper will continue to be Timings.
2018-03-31 14:55:42 -04:00

36 lines
1.3 KiB
Diff

From 51f002ac4471d23a58b5746bc588dd050a2bcb47 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 eb698733..c2f26577 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.3