use decorationIfAbsent

This commit is contained in:
Ryder Belserion 2023-07-20 21:03:22 -04:00
parent e110230d24
commit 27582743d3
No known key found for this signature in database
GPG Key ID: 6F86975AD74B46E5

View File

@ -166,12 +166,8 @@ public class BaseItemBuilder<Base extends BaseItemBuilder<Base>> {
this.itemMeta = itemStack.hasItemMeta() ? itemStack.getItemMeta() : Bukkit.getServer().getItemFactory().getItemMeta(material);
}
private void setDisplayName(Component displayName) {
this.itemMeta.displayName(displayName);
}
public Base setDisplayName(Component displayName, boolean removeItalics) {
if (removeItalics) { this.itemMeta.displayName(displayName.decoration(TextDecoration.ITALIC, false)); } else setDisplayName(displayName);
public Base setDisplayName(Component displayName) {
this.itemMeta.displayName(displayName.decorationIfAbsent(TextDecoration.ITALIC, TextDecoration.State.FALSE));
return (Base) this;
}