diff --git a/src/main/kotlin/net/axay/kspigot/extensions/bukkit/CommandExtensions.kt b/src/main/kotlin/net/axay/kspigot/extensions/bukkit/CommandExtensions.kt new file mode 100644 index 00000000..7f0a2e37 --- /dev/null +++ b/src/main/kotlin/net/axay/kspigot/extensions/bukkit/CommandExtensions.kt @@ -0,0 +1,19 @@ +package net.axay.kspigot.extensions.bukkit + +import net.axay.kspigot.main.KSpigotMainInstance +import org.bukkit.command.CommandExecutor +import org.bukkit.command.TabCompleter + +/** + * Registers this CommandExecutor for + * the given command. + */ +fun CommandExecutor.register(commandName: String): Boolean { + KSpigotMainInstance.getCommand(commandName)?.let { + it.setExecutor(this) + if (this is TabCompleter) + it.tabCompleter = this + return true + } + return false +} \ No newline at end of file diff --git a/src/main/kotlin/net/axay/kspigot/utils/RegisterableCommand.kt b/src/main/kotlin/net/axay/kspigot/utils/RegisterableCommand.kt deleted file mode 100644 index 2bc2802c..00000000 --- a/src/main/kotlin/net/axay/kspigot/utils/RegisterableCommand.kt +++ /dev/null @@ -1,26 +0,0 @@ -package net.axay.kspigot.utils - -import net.axay.kspigot.main.KSpigotMainInstance -import org.bukkit.command.CommandExecutor -import org.bukkit.command.TabCompleter - -interface RegisterableCommand : CommandExecutor { - - /** - * Registers this executor for the given command - * and for the given instance of [kSpigot]. - * - * @return true if the command was found - - * false if not - */ - fun registerAs(commandName: String): Boolean { - KSpigotMainInstance.getCommand(commandName)?.let { - it.setExecutor(this) - if (this is TabCompleter) - it.tabCompleter = this - return true - } - return false - } - -} \ No newline at end of file