mirror of
https://github.com/Auxilor/EcoQuests.git
synced 2025-12-31 12:56:41 +00:00
Added on-complete
This commit is contained in:
@@ -152,6 +152,7 @@ class Task(
|
||||
|
||||
if (newXp >= requiredXp) {
|
||||
player.profile.write(hasCompletedKey, true)
|
||||
template.onComplete?.trigger(player)
|
||||
|
||||
Bukkit.getPluginManager().callEvent(PlayerTaskCompleteEvent(player, template, quest))
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.willfp.eco.core.registry.KRegistrable
|
||||
import com.willfp.ecoquests.quests.Quest
|
||||
import com.willfp.libreforge.ViolationContext
|
||||
import com.willfp.libreforge.counters.Counters
|
||||
import com.willfp.libreforge.effects.Effects
|
||||
|
||||
class TaskTemplate(
|
||||
private val plugin: EcoPlugin,
|
||||
@@ -16,6 +17,11 @@ class TaskTemplate(
|
||||
Counters.compile(it, ViolationContext(plugin, "task $id tasks"))
|
||||
}
|
||||
|
||||
val onComplete = Effects.compileChain(
|
||||
config.getSubsections("on-complete"),
|
||||
ViolationContext(plugin, "task $id on-complete")
|
||||
)
|
||||
|
||||
fun create(quest: Quest, xpExpr: String) =
|
||||
Task(plugin, this, quest, xpExpr)
|
||||
}
|
||||
|
||||
@@ -21,3 +21,10 @@ xp-gain-methods:
|
||||
filters:
|
||||
blocks:
|
||||
- stone
|
||||
|
||||
# An optional list of effects to run when a player completes the task
|
||||
# Read here: https://plugins.auxilor.io/effects/configuring-an-effect
|
||||
on-complete:
|
||||
- id: send_message
|
||||
args:
|
||||
message: "Task Completed!"
|
||||
|
||||
Reference in New Issue
Block a user