Skip to content

Commit

Permalink
fix: Store and retrieve script-template settings in a more reliable way
Browse files Browse the repository at this point in the history
  • Loading branch information
Griefed committed Sep 24, 2023
1 parent 3d695ae commit e603165
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -810,25 +810,21 @@ actual class ApiProperties(
@Suppress("SetterBackingFieldAssignment")
var scriptTemplates: TreeSet<File> = TreeSet<File>()
get() {
val entries = getFileListProperty(
/*val entries = getFileListProperty(
pServerPackScriptTemplates,
fallbackScriptTemplates,
serverFilesDirectory.absolutePath + File.separator
)
)*/
val entries = getListProperty(pServerPackScriptTemplates,defaultScriptTemplates().map { it.absolutePath }.joinToString(",")).map { File(it).absoluteFile }

Check notice on line 818 in serverpackcreator-api/src/jvmMain/kotlin/de/griefed/serverpackcreator/api/ApiProperties.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Call chain on collection type can be simplified

Call chain on collection type may be simplified
field.clear()
field.addAll(entries)
return field
}
set(value) {
val entries = value.map { it.name }
val entries = value.map { it.absolutePath }
setListProperty(pServerPackScriptTemplates, entries, ",")
val files = getFileListProperty(
pServerPackScriptTemplates,
fallbackScriptTemplates,
serverFilesDirectory.absolutePath + File.separator
)
field.clear()
field.addAll(files)
field.addAll(value.map { it.absoluteFile })
log.info("Using script templates:")
for (template in field) {
log.info(" " + template.path)
Expand Down

0 comments on commit e603165

Please sign in to comment.