mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-27 10:41:27 +01:00
SPIGOT-4177: Change behaviour of item display names yet again
By: md_5 <git@md-5.net>
This commit is contained in:
parent
9202a305e9
commit
9123e804dc
@ -566,7 +566,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void setDisplayName(String name) {
|
public final void setDisplayName(String name) {
|
||||||
this.displayName = (name == null) ? null : new ChatComponentText(name);
|
this.displayName = CraftChatMessage.wrapOrNull(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasDisplayName() {
|
public boolean hasDisplayName() {
|
||||||
@ -580,7 +580,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLocalizedName(String name) {
|
public void setLocalizedName(String name) {
|
||||||
this.locName = (name == null) ? null : new ChatComponentText(name);
|
this.locName = CraftChatMessage.wrapOrNull(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -138,6 +138,10 @@ public final class CraftChatMessage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IChatBaseComponent wrapOrNull(String message) {
|
||||||
|
return (message == null || message.isEmpty()) ? null : new ChatComponentText(message);
|
||||||
|
}
|
||||||
|
|
||||||
public static IChatBaseComponent fromStringOrNull(String message) {
|
public static IChatBaseComponent fromStringOrNull(String message) {
|
||||||
return (message == null || message.isEmpty()) ? null : fromString(message)[0];
|
return (message == null || message.isEmpty()) ? null : fromString(message)[0];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user