mirror of
https://github.com/Auxilor/EcoQuests.git
synced 2026-01-04 15:41:38 +00:00
Added %ecoquests_recent_quest_name% and improved lore
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package com.willfp.ecoquests
|
||||
|
||||
import com.willfp.eco.core.command.impl.PluginCommand
|
||||
import com.willfp.eco.core.data.profile
|
||||
import com.willfp.eco.core.placeholder.PlayerPlaceholder
|
||||
import com.willfp.eco.core.placeholder.PlayerlessPlaceholder
|
||||
import com.willfp.eco.core.placeholder.context.PlaceholderContext
|
||||
import com.willfp.eco.core.placeholder.templates.SimpleInjectablePlaceholder
|
||||
import com.willfp.eco.util.toNiceString
|
||||
import com.willfp.ecoquests.commands.CommandEcoQuests
|
||||
import com.willfp.ecoquests.commands.CommandQuests
|
||||
@@ -69,6 +72,10 @@ class EcoQuestsPlugin : LibreforgePlugin() {
|
||||
PlayerPlaceholder(this, "quests_active") {
|
||||
Quests.getActiveQuests(it).size.toString()
|
||||
}.register()
|
||||
|
||||
PlayerPlaceholder(this, "recent_quest_name") {
|
||||
Quests.getActiveQuests(it).minBy { quest -> quest.getTimeSinceStart(it) }.name
|
||||
}
|
||||
}
|
||||
|
||||
override fun handleReload() {
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.willfp.eco.core.placeholder.PlayerlessPlaceholder
|
||||
import com.willfp.eco.core.placeholder.context.placeholderContext
|
||||
import com.willfp.eco.core.registry.KRegistrable
|
||||
import com.willfp.eco.util.formatEco
|
||||
import com.willfp.eco.util.lineWrap
|
||||
import com.willfp.eco.util.toNiceString
|
||||
import com.willfp.ecoquests.api.event.PlayerQuestCompleteEvent
|
||||
import com.willfp.ecoquests.api.event.PlayerQuestStartEvent
|
||||
@@ -420,7 +421,7 @@ class Quest(
|
||||
rewardMessages
|
||||
.addMargin(margin)
|
||||
} else if (s.contains("%tasks%")) {
|
||||
tasks.flatMap { task -> task.getCompletedDescription(player) }
|
||||
tasks.map { task -> task.getCompletedDescription(player) }
|
||||
.addMargin(margin)
|
||||
} else if (s.contains("%description%")) {
|
||||
getDescription(player)
|
||||
@@ -434,6 +435,6 @@ class Quest(
|
||||
placeholderContext(
|
||||
player = player
|
||||
)
|
||||
)
|
||||
).lineWrap(plugin.configYml.getInt("quests.icon.line-wrap"), true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,15 +145,13 @@ class Task(
|
||||
.formatEco(player)
|
||||
}
|
||||
|
||||
fun getCompletedDescription(player: Player): List<String> {
|
||||
fun getCompletedDescription(player: Player): String {
|
||||
return if (hasCompleted(player)) {
|
||||
plugin.configYml.getString("tasks.completed")
|
||||
.replace("%description%", getDescription(player))
|
||||
.lineWrap(plugin.configYml.getInt("tasks.line-wrap"), true)
|
||||
} else {
|
||||
plugin.configYml.getString("tasks.not-completed")
|
||||
.replace("%description%", getDescription(player))
|
||||
.lineWrap(plugin.configYml.getInt("tasks.line-wrap"), true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,10 +34,13 @@ gui:
|
||||
|
||||
quest-info:
|
||||
item: writable_book
|
||||
name: "&aQuest Book"
|
||||
name: "&fQuest Book"
|
||||
lore:
|
||||
- "&eClick to view your"
|
||||
- "&eprevious quests!"
|
||||
- ""
|
||||
- "&fQuests Completed: &f%ecoquests_quests_completed%"
|
||||
- "&fQuests Active: &f%ecoquests_quests_active%"
|
||||
- ""
|
||||
- "&eClick to view past quests!"
|
||||
|
||||
location:
|
||||
row: 1
|
||||
@@ -130,12 +133,12 @@ completed-gui:
|
||||
custom-slots: [ ]
|
||||
|
||||
tasks:
|
||||
line-wrap: 32
|
||||
completed: "&a&l✓ &r&f%description%"
|
||||
not-completed: "&c&l✘ &r&f%description%"
|
||||
completed: "&a&l✔ &r&f%description%"
|
||||
not-completed: "&c&l❌ &r&f%description%"
|
||||
|
||||
quests:
|
||||
icon:
|
||||
line-wrap: 32
|
||||
lore:
|
||||
- "%description%"
|
||||
- ""
|
||||
|
||||
Reference in New Issue
Block a user