Paper/patches/api/0065-Add-getI18NDisplayName-API.patch
Jake Potrebic d8847bc1f3
Updated Upstream (Bukkit/CraftBukkit) (#9922)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
fde5602a PR-927: Add PlayerRecipeBookSettingsChangeEvent
949ff217 PR-930: Add methods to get/set evoker fang attack delay
f6f7c79d SPIGOT-7514, PR-929: Add "Enchantment Roll" API to enchant items according to Minecraft mechanics
d40e22da PR-712: Add API to get full result of crafting items

CraftBukkit Changes:
c8feb0629 PR-1291: Improve precondition message in Entity#playEffect
482c56a00 PR-1285: Add PlayerRecipeBookSettingsChangeEvent
cdf798800 PR-1290: Add methods to get/set evoker fang attack delay
2c1b5f78f SPIGOT-7514, PR-1289: Add "Enchantment Roll" API to enchant items according to Minecraft mechanics
6aa644ae9 PR-992: Add API to get full result of crafting items
ffb1319bc PR-1287: Fix scoreboards not updating in Player#setStatistic
2023-11-11 12:25:45 -08:00

60 lines
2.8 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 6b1c55249b39a45c33ac49bacef4e9d80ba8cc3a..cccf5d3dfd368c434dcafb0e9319f09a668c7ec2 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -237,4 +237,20 @@ public interface ItemFactory {
@NotNull
net.kyori.adventure.text.Component displayName(@NotNull ItemStack itemStack);
// Paper end - Adventure
+
+ // Paper start - add 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.
+ *
+ * @param item Item to return Display name of
+ * @return Display name of Item
+ * @deprecated {@link ItemStack} implements {@link net.kyori.adventure.translation.Translatable}; use that and
+ * {@link net.kyori.adventure.text.Component#translatable(net.kyori.adventure.translation.Translatable)} instead.
+ */
+ @Nullable
+ @Deprecated
+ String getI18NDisplayName(@Nullable ItemStack item);
+ // Paper end - add getI18NDisplayName
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 9d327f0832c40d4a8d212346284274f6cf78834f..09a36df6edce2a283df80c67d5ef62da7ff73555 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -618,5 +618,20 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
public net.kyori.adventure.text.@NotNull Component displayName() {
return Bukkit.getServer().getItemFactory().displayName(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
+ * @deprecated {@link ItemStack} implements {@link net.kyori.adventure.translation.Translatable}; use that and
+ * {@link net.kyori.adventure.text.Component#translatable(net.kyori.adventure.translation.Translatable)} instead.
+ */
+ @Nullable
+ @Deprecated
+ public String getI18NDisplayName() {
+ return Bukkit.getServer().getItemFactory().getI18NDisplayName(this);
+ }
// Paper end
}