More stuff.

This commit is contained in:
2023-03-05 17:33:54 -08:00
parent c973a1a3c6
commit 3d4862adc0
25 changed files with 345 additions and 69 deletions

View File

@ -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
}
}
}
}