hibiscus/src/main/kotlin/codes/som/hibiscus/commands/CommandRegistry.kt

26 lines
518 B
Kotlin

package codes.som.hibiscus.commands
import codes.som.hibiscus.api.command.Command
import codes.som.hibiscus.api.command.CommandManager
fun allCommandClasses(): Array<() -> Command> = arrayOf(
::Reload,
::Vclip,
::Gamma,
)
class CommandRegistry : CommandManager() {
init {
registerCommands()
}
private fun registerCommands() {
allCommandClasses().map { it() }.forEach(this::register)
}
override fun reset() {
super.reset()
registerCommands()
}
}