-
-
Save andrewgazelka/90c1324631f74228ffa1bd0b90fb51fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseCommandBukkit(private val simpleCommand: io.simplyservers.simplecore.api.command.SimpleCommand) : CommandExecutor, TabExecutor { | |
override fun onTabComplete(sender: CommandSender, command: Command, alias: String, args: Array<out String>): MutableList<String> { | |
return simpleCommand.onTabComplete(sender, command, alias, args).toMutableList() | |
} | |
override fun onCommand(sender: CommandSender, command: Command, alias: String, args: Array<out String>): Boolean { | |
if (!simpleCommand.on(sender, command, alias, args)) { | |
TODO() | |
} | |
return true | |
} | |
fun register(plugin: Plugin) { | |
val pluginCommand = plugin.server.getPluginCommand(simpleCommand.name) | |
pluginCommand.aliases = simpleCommand.aliases.toMutableList() | |
pluginCommand.executor = this | |
pluginCommand.tabCompleter = this | |
} | |
} | |
fun SimpleCommand.register(plugin: Plugin) { | |
BaseCommandBukkit(this).register(plugin) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment