9
0
mirror of https://github.com/Auxilor/EcoQuests.git synced 2025-12-26 10:29:07 +00:00

Cleanup more

This commit is contained in:
Auxilor
2023-08-10 15:36:13 +01:00
parent e7a16550ac
commit 406ff65a6d
2 changed files with 7 additions and 13 deletions

View File

@@ -69,13 +69,8 @@ class Quest(
// The pool of available tasks to pick from
private val availableTasks = config.getSubsections("tasks")
.mapNotNull {
Task(
plugin,
// Could probably clean
Tasks[it.getString("task")] ?: return@mapNotNull null,
this,
it.getString("xp")
)
Tasks[it.getString("task")]
?.create(this, it.getString("xp"))
}
// The amount of tasks to use from the pool
@@ -309,12 +304,7 @@ class Quest(
val template = Tasks[taskId] ?: continue
savedTasks += Task(
plugin,
template,
this,
xpExpr
)
savedTasks += template.create(this, xpExpr)
}
return savedTasks

View File

@@ -3,6 +3,7 @@ package com.willfp.ecoquests.tasks
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.config.interfaces.Config
import com.willfp.eco.core.registry.KRegistrable
import com.willfp.ecoquests.quests.Quest
import com.willfp.libreforge.ViolationContext
import com.willfp.libreforge.counters.Counters
@@ -14,4 +15,7 @@ class TaskTemplate(
val xpGainMethods = config.getSubsections("xp-gain-methods").mapNotNull {
Counters.compile(it, ViolationContext(plugin, "task $id tasks"))
}
fun create(quest: Quest, xpExpr: String) =
Task(plugin, this, quest, xpExpr)
}