mirror of
https://github.com/Auxilor/EcoQuests.git
synced 2025-12-26 10:29:07 +00:00
Cleanup more
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user