2021-06-11 14:02:28 +02:00
|
|
|
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
|
2024-04-24 01:31:55 +02:00
|
|
|
index dbaf54018a7dd392378869a5a302a880c7a56338..213e3f3de731d85f788a4bfa8d912e1b59c3c045 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
2024-01-14 10:46:04 +01:00
|
|
|
@@ -235,4 +235,20 @@ public interface ItemFactory {
|
2021-06-11 14:02:28 +02:00
|
|
|
@NotNull
|
2021-06-12 13:18:01 +02:00
|
|
|
net.kyori.adventure.text.Component displayName(@NotNull ItemStack itemStack);
|
2023-08-06 02:21:59 +02:00
|
|
|
// Paper end - Adventure
|
2021-06-11 14:02:28 +02:00
|
|
|
+
|
2023-08-06 02:21:59 +02:00
|
|
|
+ // Paper start - add getI18NDisplayName
|
2021-06-11 14:02:28 +02:00
|
|
|
+ /**
|
|
|
|
+ * Gets the Display name as seen in the Client.
|
2023-08-06 02:21:59 +02:00
|
|
|
+ * Currently, the server only supports the English language. To override this,
|
2021-06-11 14:02:28 +02:00
|
|
|
+ * You must replace the language file embedded in the server jar.
|
|
|
|
+ *
|
|
|
|
+ * @param item Item to return Display name of
|
|
|
|
+ * @return Display name of Item
|
2022-01-17 01:53:26 +01:00
|
|
|
+ * @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.
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
|
|
|
+ @Nullable
|
2022-01-17 01:53:26 +01:00
|
|
|
+ @Deprecated
|
2021-06-11 14:02:28 +02:00
|
|
|
+ String getI18NDisplayName(@Nullable ItemStack item);
|
2023-08-06 02:21:59 +02:00
|
|
|
+ // Paper end - add getI18NDisplayName
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
2024-04-25 23:21:18 +02:00
|
|
|
index f2a6f62f0344684668febc0999b81748c6737826..d1bce73317fa1dfd35c8b3f94415ba8721c758d6 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
2024-04-25 23:21:18 +02:00
|
|
|
@@ -630,5 +630,20 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
2023-03-23 17:49:24 +01:00
|
|
|
public net.kyori.adventure.text.@NotNull Component displayName() {
|
2021-06-12 13:18:01 +02:00
|
|
|
return Bukkit.getServer().getItemFactory().displayName(this);
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 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
|
2022-01-17 01:53:26 +01:00
|
|
|
+ * @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.
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
|
|
|
+ @Nullable
|
2022-01-17 01:53:26 +01:00
|
|
|
+ @Deprecated
|
2021-06-11 14:02:28 +02:00
|
|
|
+ public String getI18NDisplayName() {
|
|
|
|
+ return Bukkit.getServer().getItemFactory().getI18NDisplayName(this);
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|