Skip to content

Commit

Permalink
refactor: remove parent italics by default
Browse files Browse the repository at this point in the history
  • Loading branch information
DebitCardz committed Jun 11, 2023
1 parent 293f04a commit 1e16558
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/kotlin/me/tech/mcchestui/GUIItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand All @@ -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
}
Expand All @@ -76,8 +76,8 @@ class GUIItem(
var lore: Collection<Component>?
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
}
Expand Down

0 comments on commit 1e16558

Please sign in to comment.