More stuff.

This commit is contained in:
alex committed 2023-03-05 17:33:54 -08:00
1 parent c973a1a3c6
commit 3d4862adc0
25 files changed
+345 -69

No files matched your search

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