Add ItemStack#displayName to get the formatted display name of an ItemStack (#5628)

The display name includes formatting such as item hover event, display name (in italics if renamed in anvil), and color based on rarity.

This is what vanilla uses for give command feedback, and when an item is shown in a death message.
This commit is contained in:
Jason
2021-05-12 23:16:33 -07:00
committed by GitHub
parent 4efe8b498b
commit 453c7f05c7
13 changed files with 72 additions and 37 deletions

View File

@@ -88,10 +88,10 @@ index 84eda68281c6c6968d95b1313a33696c3a9980d4..bcd10b2c9255d778b678310febf19373
// Paper end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index a3335b8622a70fbf4a55213f1a5010ffdc4783bb..b9694780d824063cf90cd968d3e6b57f49fcbeb3 100644
index c236cb81b7ec7993b63da929c0492564e75581ee..7929a00a3e93e0b6a4df99013e0da5bcfecd678b 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -854,5 +854,15 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
@@ -863,5 +863,15 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
public String getTranslationKey() {
return Bukkit.getUnsafe().getTranslationKey(this);
}