mirror of
https://github.com/GayPizzaSpecifications/foundation.git
synced 2025-08-05 14:31:32 +00:00
More stuff.
This commit is contained in:
@ -0,0 +1,21 @@
|
||||
package gay.pizza.foundation.common
|
||||
|
||||
import org.bukkit.command.CommandExecutor
|
||||
import org.bukkit.command.TabCompleter
|
||||
import org.bukkit.plugin.java.JavaPlugin
|
||||
|
||||
abstract class BaseFoundationPlugin : JavaPlugin() {
|
||||
fun registerCommandExecutor(name: String, executor: CommandExecutor) {
|
||||
registerCommandExecutor(listOf(name), executor)
|
||||
}
|
||||
|
||||
fun registerCommandExecutor(names: List<String>, executor: CommandExecutor) {
|
||||
for (name in names) {
|
||||
val command = getCommand(name) ?: throw Exception("Failed to get $name command")
|
||||
command.setExecutor(executor)
|
||||
if (executor is TabCompleter) {
|
||||
command.tabCompleter = executor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user