9
0
mirror of https://github.com/Auxilor/EcoQuests.git synced 2025-12-19 15:09:22 +00:00

improved sorting and multi-line descriptions

This commit is contained in:
Exanthiax
2024-09-22 15:12:11 +01:00
parent 5e51c369bb
commit c1c985d638

View File

@@ -101,12 +101,22 @@ class Quest(
// The tasks that are actually in use // The tasks that are actually in use
var tasks = run { var tasks = run {
if (taskAmount == availableTasks.size) {
// If taskAmount is equal to availableTasks.size then tasks are ordered as configured
if (isResettable) {
availableTasks.take(taskAmount)
} else {
availableTasks.shuffled().take(taskAmount)
}
} else {
// If taskAmount is less than availableTasks.size then tasks are selected and ordered randomly.
if (isResettable) { if (isResettable) {
loadTasks() ?: availableTasks.randomlyPick(taskAmount) loadTasks() ?: availableTasks.randomlyPick(taskAmount)
} else { } else {
availableTasks.randomlyPick(taskAmount) availableTasks.randomlyPick(taskAmount)
} }
} }
}
private set private set
private val hasStartedKey = PersistentDataKey( private val hasStartedKey = PersistentDataKey(
@@ -268,7 +278,8 @@ class Quest(
} }
fun getDescription(player: Player): List<String> { fun getDescription(player: Player): List<String> {
return addPlaceholdersInto(listOf(config.getString("description")), player) val descriptions = config.getStrings("description")
return addPlaceholdersInto(descriptions, player)
} }
fun hasActive(player: OfflinePlayer): Boolean { fun hasActive(player: OfflinePlayer): Boolean {