9
0
mirror of https://github.com/Auxilor/EcoQuests.git synced 2026-01-04 15:41:38 +00:00

Added commands

This commit is contained in:
Auxilor
2023-08-08 19:34:45 +01:00
parent 06b78f60df
commit 051eb37dd6
7 changed files with 112 additions and 2 deletions

View File

@@ -1,5 +1,8 @@
package com.willfp.ecoquests
import com.willfp.eco.core.command.impl.PluginCommand
import com.willfp.ecoquests.commands.CommandEcoQuests
import com.willfp.ecoquests.commands.CommandQuests
import com.willfp.ecoquests.quests.Quests
import com.willfp.ecoquests.tasks.Tasks
import com.willfp.libreforge.loader.LibreforgePlugin
@@ -21,6 +24,13 @@ class EcoQuestsPlugin : LibreforgePlugin() {
}
}
override fun loadPluginCommands(): List<PluginCommand> {
return listOf(
CommandEcoQuests(this),
CommandQuests(this)
)
}
override fun loadConfigCategories(): List<ConfigCategory> {
return listOf(
Tasks,

View File

@@ -0,0 +1,22 @@
package com.willfp.ecoquests.commands
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.command.impl.PluginCommand
import org.bukkit.command.CommandSender
class CommandEcoQuests(plugin: EcoPlugin) : PluginCommand(
plugin,
"ecoquests",
"ecoquests.command.ecoquests",
false
) {
init {
this.addSubcommand(CommandReload(plugin))
}
override fun onExecute(sender: CommandSender, args: List<String>) {
sender.sendMessage(
plugin.langYml.getMessage("invalid-command")
)
}
}

View File

@@ -0,0 +1,26 @@
package com.willfp.ecoquests.commands
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.command.impl.PluginCommand
import com.willfp.ecoquests.gui.QuestsGUI
import com.willfp.libreforge.commands.CommandReload
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
class CommandQuests(plugin: EcoPlugin) : PluginCommand(
plugin,
"quests",
"ecoquests.command.quests",
true
) {
override fun getAliases(): List<String> {
return listOf(
"q",
"quest"
)
}
override fun onExecute(sender: Player, args: List<String>) {
QuestsGUI.open(sender)
}
}

View File

@@ -0,0 +1,17 @@
package com.willfp.ecoquests.commands
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.command.impl.Subcommand
import org.bukkit.command.CommandSender
class CommandReload(plugin: EcoPlugin) : Subcommand(
plugin,
"reload",
"ecoquests.command.reload",
false
) {
override fun onExecute(sender: CommandSender, args: List<String>) {
plugin.reload()
sender.sendMessage(plugin.langYml.getMessage("reloaded"))
}
}

View File

@@ -7,3 +7,38 @@ website: willfp.com
load: STARTUP
depend:
- eco
commands:
ecoquests:
description: Base Command
permission: ecoquests.command.ecoquests
quests:
aliases:
- q
- quest
description: Open the quests menu
permission: ecoquests.command.quests
permissions:
ecoquests.*:
description: All ecoquests permissions
default: op
children:
ecoquests.command.*: true
ecoquests.command.*:
description: All commands
default: op
children:
ecoquests.command.reload: true
ecoquests.command.quests: true
ecoquests.command.reload:
description: Allows reloading the config
default: op
ecoquests.command.ecoquests:
description: Allows the use of /ecoquests.
default: true
ecoquests.command.quests:
description: Allows the use of /quests.
default: true

View File

@@ -11,7 +11,7 @@ required-xp: 100
# The multiplier takes the value produced by the trigger and multiplies it
# by some value to calculate the experience that should be given.
tasks:
- trigger: break_block
- trigger: mine_block
multiplier: 1
filters:
blocks:

View File

@@ -11,7 +11,7 @@ required-xp: 100
# The multiplier takes the value produced by the trigger and multiplies it
# by some value to calculate the experience that should be given.
tasks:
- trigger: break_block
- trigger: mine_block
multiplier: 1
filters:
blocks: