Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ javaVersion=21
mcVersion=1.21.4

group=dev.slne.surf
version=1.21.4-2.13.1-SNAPSHOT
version=1.21.4-2.13.2-SNAPSHOT
relocationPrefix=dev.slne.surf.surfapi.libs
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,7 @@ object CommonComponents {
collection: Iterable<E>,
formatter: (E) -> Component,
): Component {
val joinConfig = JoinConfiguration.builder()
.separator(Component.text(", ", SPACER))
.build()
val joinConfig = JoinConfiguration.builder().separator(Component.text(", ", SPACER)).build()

return Component.join(joinConfig, collection.mapTo(mutableObjectListOf(), formatter))
}
Expand Down Expand Up @@ -382,15 +380,20 @@ object CommonComponents {
linePrefix: Component = PREFIX,
formatter: (E) -> Component,
): Component {
val joinConfig = JoinConfiguration.builder()
.separator(buildText0 {
appendNewline()
append(linePrefix)
appendText("- ", SPACER)
})
.build()
val separator = buildText0 {
appendNewline()
append(linePrefix)
appendText("- ", SPACER)
}
val joinConfig = JoinConfiguration.builder().separator(separator).build()

return Component.join(joinConfig, collection.mapTo(mutableObjectListOf(), formatter))
val firstPrefix = if (collection.iterator().hasNext()) separator else Component.empty()

return firstPrefix.append(
Component.join(
joinConfig, collection.mapTo(mutableObjectListOf(), formatter)
)
)
}

/**
Expand Down Expand Up @@ -422,20 +425,26 @@ object CommonComponents {
linePrefix: Component = PREFIX,
keyValueSeparator: Component = MAP_SEPERATOR,
): Component {
val joinConfig = JoinConfiguration.builder()
.separator(buildText0 {
appendNewline()
append(linePrefix)
appendText("- ", SPACER)
})

return Component.join(joinConfig, map.mapTo(mutableObjectListOf()) { (key, value) ->
buildText0 {
append(keyFormatter(key).colorIfAbsent(VARIABLE_KEY))
append(keyValueSeparator)
append(valueFormatter(value).colorIfAbsent(VARIABLE_VALUE))
}
})
val separator = buildText0 {
appendNewline()
append(linePrefix)
appendText("- ", SPACER)
}
val joinConfig = JoinConfiguration.builder().separator(separator).build()
val firstPrefix = if (map.isNotEmpty()) separator else Component.empty()

return firstPrefix.append(
Component.join(
joinConfig,
map.mapTo(mutableObjectListOf()) { (key, value) ->
buildText0 {
append(keyFormatter(key).colorIfAbsent(VARIABLE_KEY))
append(keyValueSeparator)
append(valueFormatter(value).colorIfAbsent(VARIABLE_VALUE))
}
}
)
)
}

/**
Expand Down