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:
@@ -101,10 +101,20 @@ class Quest(
|
|||||||
|
|
||||||
// The tasks that are actually in use
|
// The tasks that are actually in use
|
||||||
var tasks = run {
|
var tasks = run {
|
||||||
if (isResettable) {
|
if (taskAmount == availableTasks.size) {
|
||||||
loadTasks() ?: availableTasks.randomlyPick(taskAmount)
|
// If taskAmount is equal to availableTasks.size then tasks are ordered as configured
|
||||||
|
if (isResettable) {
|
||||||
|
availableTasks.take(taskAmount)
|
||||||
|
} else {
|
||||||
|
availableTasks.shuffled().take(taskAmount)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
availableTasks.randomlyPick(taskAmount)
|
// If taskAmount is less than availableTasks.size then tasks are selected and ordered randomly.
|
||||||
|
if (isResettable) {
|
||||||
|
loadTasks() ?: availableTasks.randomlyPick(taskAmount)
|
||||||
|
} else {
|
||||||
|
availableTasks.randomlyPick(taskAmount)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private set
|
private set
|
||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user