mirror of
https://github.com/Auxilor/EcoQuests.git
synced 2026-01-04 15:41:38 +00:00
Added not-met-lines support and option to have quests that are always in the GUI
This commit is contained in:
@@ -20,7 +20,7 @@ object QuestsGUI {
|
||||
|
||||
fun reload(plugin: EcoPlugin) {
|
||||
val questAreaComponent = QuestAreaComponent(plugin.configYml.getSubsection("gui.quest-area")) {
|
||||
Quests.getActiveQuests(it)
|
||||
Quests.getShownQuests(it)
|
||||
}
|
||||
|
||||
menu = menu(plugin.configYml.getInt("gui.rows")) {
|
||||
|
||||
@@ -30,6 +30,7 @@ class QuestAreaComponent(
|
||||
val index = MenuUtils.rowColumnToSlot(row, column, columnSize) + ((page - 1) * pageSize)
|
||||
|
||||
return getQuests(player)
|
||||
.filter { it.showsInGui }
|
||||
.getOrNull(index)
|
||||
?.slot
|
||||
}
|
||||
|
||||
@@ -46,11 +46,19 @@ class Quest(
|
||||
player
|
||||
)
|
||||
)
|
||||
|
||||
addLoreLines(
|
||||
startConditions.getNotMetLines(player, EmptyProvidedHolder)
|
||||
)
|
||||
}
|
||||
}) {
|
||||
|
||||
}
|
||||
|
||||
val showsInGui = config.getBool("gui.enabled")
|
||||
|
||||
val alwaysInGUI = config.getBool("gui.always")
|
||||
|
||||
val tasks = config.getStrings("tasks").mapNotNull { Tasks[it] }
|
||||
|
||||
private val hasStartedKey: PersistentDataKey<Boolean> = PersistentDataKey(
|
||||
|
||||
@@ -21,6 +21,11 @@ object Quests : ConfigCategory("quest", "quests") {
|
||||
|
||||
fun values(): Collection<Quest> = registry.values()
|
||||
|
||||
fun getShownQuests(player: Player): List<Quest> {
|
||||
return values()
|
||||
.filter { it.hasActive(player) || (it.alwaysInGUI && !it.hasCompleted(player)) }
|
||||
}
|
||||
|
||||
fun getActiveQuests(player: Player): List<Quest> {
|
||||
return values()
|
||||
.filter { it.hasActive(player) }
|
||||
|
||||
@@ -3,6 +3,8 @@ name: "Example Quest"
|
||||
description: "Example Description"
|
||||
|
||||
gui:
|
||||
enabled: true # If the quest should be shown in the GUI
|
||||
always: false # If the quest should always be in the GUI, even if it's not started
|
||||
item: paper name:"&eExample Quest"
|
||||
|
||||
# How many minutes between this quest being reset (set to -1 to disable)
|
||||
|
||||
@@ -3,6 +3,8 @@ name: "Resettable Quest"
|
||||
description: "&fThis quest will reset in &a%time_until_reset%"
|
||||
|
||||
gui:
|
||||
enabled: true # If the quest should be shown in the GUI
|
||||
always: false # If the quest should always be in the GUI, even if it's not started
|
||||
item: paper name:"&eExample Quest"
|
||||
|
||||
# How many minutes between this quest being reset (set to -1 to disable)
|
||||
|
||||
Reference in New Issue
Block a user