From 1e16558521cbb1de7b88942945d90a1879e254ee Mon Sep 17 00:00:00 2001 From: Tech Date: Sun, 11 Jun 2023 12:10:48 -0400 Subject: [PATCH] refactor: remove parent italics by default --- src/main/kotlin/me/tech/mcchestui/GUIItem.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/me/tech/mcchestui/GUIItem.kt b/src/main/kotlin/me/tech/mcchestui/GUIItem.kt index 52966d4..94730cc 100644 --- a/src/main/kotlin/me/tech/mcchestui/GUIItem.kt +++ b/src/main/kotlin/me/tech/mcchestui/GUIItem.kt @@ -37,7 +37,7 @@ class GUIItem( /** * Whether to remove default italics from the [ItemMeta]. */ - var removeDefaultItalics = false + var removeParentItalics = true /** * Modify the [ItemStack] of the [GUIItem]. @@ -59,8 +59,8 @@ class GUIItem( var name: Component? get() = itemMeta.displayName() set(value) { - val name = if(removeDefaultItalics) { - value?.decoration(TextDecoration.ITALIC, false) + val name = if(removeParentItalics) { + value?.decorationIfAbsent(TextDecoration.ITALIC, TextDecoration.State.FALSE) } else { value } @@ -76,8 +76,8 @@ class GUIItem( var lore: Collection? get() = itemMeta.lore() set(value) { - val lore = if(removeDefaultItalics) { - value?.map { it.decoration(TextDecoration.ITALIC, false) } + val lore = if(removeParentItalics) { + value?.map { it.decorationIfAbsent(TextDecoration.ITALIC, TextDecoration.State.FALSE) } } else { value }