mirror of
https://github.com/GayPizzaSpecifications/foundation.git
synced 2025-08-03 13:31:32 +00:00
More stuff.
This commit is contained in:
@ -4,6 +4,7 @@ plugins {
|
||||
|
||||
dependencies {
|
||||
api(project(":common-all"))
|
||||
api(project(":common-plugin"))
|
||||
implementation(project(":foundation-shared"))
|
||||
|
||||
implementation(libs.aws.sdk.s3)
|
||||
|
@ -1,8 +1,6 @@
|
||||
package gay.pizza.foundation.core.abstraction
|
||||
|
||||
import gay.pizza.foundation.core.FoundationCorePlugin
|
||||
import org.bukkit.command.CommandExecutor
|
||||
import org.bukkit.command.TabCompleter
|
||||
import org.bukkit.event.Listener
|
||||
import org.koin.core.component.KoinComponent
|
||||
import org.koin.core.component.inject
|
||||
@ -16,18 +14,4 @@ abstract class Feature : CoreFeature, KoinComponent, Listener {
|
||||
override fun enable() {}
|
||||
override fun disable() {}
|
||||
override fun module() = module {}
|
||||
|
||||
protected fun registerCommandExecutor(name: String, executor: CommandExecutor) {
|
||||
registerCommandExecutor(listOf(name), executor)
|
||||
}
|
||||
|
||||
protected fun registerCommandExecutor(names: List<String>, executor: CommandExecutor) {
|
||||
for (name in names) {
|
||||
val command = plugin.getCommand(name) ?: throw Exception("Failed to get $name command")
|
||||
command.setExecutor(executor)
|
||||
if (executor is TabCompleter) {
|
||||
command.tabCompleter = executor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
package gay.pizza.foundation.core.abstraction
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin
|
||||
import gay.pizza.foundation.common.BaseFoundationPlugin
|
||||
import org.koin.core.KoinApplication
|
||||
import org.koin.core.context.startKoin
|
||||
import org.koin.core.context.stopKoin
|
||||
import org.koin.core.module.Module
|
||||
import org.koin.dsl.module
|
||||
|
||||
abstract class FoundationPlugin : JavaPlugin() {
|
||||
abstract class FoundationPlugin : BaseFoundationPlugin() {
|
||||
private lateinit var pluginModule: Module
|
||||
private lateinit var pluginApplication: KoinApplication
|
||||
private lateinit var features: List<CoreFeature>
|
||||
|
@ -1,11 +1,11 @@
|
||||
package gay.pizza.foundation.core.features.backup
|
||||
|
||||
import com.charleskorn.kaml.Yaml
|
||||
import gay.pizza.foundation.shared.copyDefaultConfig
|
||||
import gay.pizza.foundation.core.FoundationCorePlugin
|
||||
import gay.pizza.foundation.core.abstraction.Feature
|
||||
import gay.pizza.foundation.core.features.scheduler.cancel
|
||||
import gay.pizza.foundation.core.features.scheduler.cron
|
||||
import gay.pizza.foundation.shared.copyDefaultConfig
|
||||
import org.koin.core.component.inject
|
||||
import org.koin.dsl.module
|
||||
import software.amazon.awssdk.auth.credentials.AwsSessionCredentials
|
||||
@ -25,7 +25,7 @@ class BackupFeature : Feature() {
|
||||
val backupPath = plugin.pluginDataPath.resolve(BACKUPS_DIRECTORY)
|
||||
backupPath.toFile().mkdir()
|
||||
|
||||
registerCommandExecutor("fbackup", BackupCommand(plugin, backupPath, config, s3Client))
|
||||
plugin.registerCommandExecutor("fbackup", BackupCommand(plugin, backupPath, config, s3Client))
|
||||
|
||||
if (config.schedule.cron.isNotEmpty()) {
|
||||
// Assume the user never wants to modify the second. I'm not sure why this is enforced in Quartz.
|
||||
|
@ -4,9 +4,9 @@ import com.charleskorn.kaml.Yaml
|
||||
import com.google.common.cache.Cache
|
||||
import com.google.common.cache.CacheBuilder
|
||||
import com.google.common.cache.RemovalCause
|
||||
import gay.pizza.foundation.shared.copyDefaultConfig
|
||||
import gay.pizza.foundation.core.FoundationCorePlugin
|
||||
import gay.pizza.foundation.core.abstraction.Feature
|
||||
import gay.pizza.foundation.shared.copyDefaultConfig
|
||||
import net.kyori.adventure.text.Component
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.event.EventHandler
|
||||
@ -42,13 +42,13 @@ class PlayerFeature : Feature() {
|
||||
playerActivity.cleanUp()
|
||||
}, 20, 100)
|
||||
|
||||
registerCommandExecutor(listOf("survival", "s"), GamemodeCommand(GameMode.SURVIVAL))
|
||||
registerCommandExecutor(listOf("creative", "c"), GamemodeCommand(GameMode.CREATIVE))
|
||||
registerCommandExecutor(listOf("adventure", "a"), GamemodeCommand(GameMode.ADVENTURE))
|
||||
registerCommandExecutor(listOf("spectator", "sp"), GamemodeCommand(GameMode.SPECTATOR))
|
||||
registerCommandExecutor(listOf("localweather", "lw"), LocalWeatherCommand())
|
||||
registerCommandExecutor(listOf("goose", "the_most_wonderful_kitty_ever"), GooseCommand())
|
||||
registerCommandExecutor(listOf("megatnt"), MegaTntCommand())
|
||||
plugin.registerCommandExecutor(listOf("survival", "s"), GamemodeCommand(GameMode.SURVIVAL))
|
||||
plugin.registerCommandExecutor(listOf("creative", "c"), GamemodeCommand(GameMode.CREATIVE))
|
||||
plugin.registerCommandExecutor(listOf("adventure", "a"), GamemodeCommand(GameMode.ADVENTURE))
|
||||
plugin.registerCommandExecutor(listOf("spectator", "sp"), GamemodeCommand(GameMode.SPECTATOR))
|
||||
plugin.registerCommandExecutor(listOf("localweather", "lw"), LocalWeatherCommand())
|
||||
plugin.registerCommandExecutor(listOf("goose", "the_most_wonderful_kitty_ever"), GooseCommand())
|
||||
plugin.registerCommandExecutor(listOf("megatnt"), MegaTntCommand())
|
||||
}
|
||||
|
||||
override fun module() = org.koin.dsl.module {
|
||||
|
@ -19,8 +19,8 @@ class StatsFeature : Feature() {
|
||||
override fun enable() {
|
||||
chatLogStore = persistence.value.store("chat-logs")
|
||||
|
||||
registerCommandExecutor(listOf("leaderboard", "lb"), LeaderboardCommand())
|
||||
registerCommandExecutor("pstore", PersistentStoreCommand(this))
|
||||
plugin.registerCommandExecutor(listOf("leaderboard", "lb"), LeaderboardCommand())
|
||||
plugin.registerCommandExecutor("pstore", PersistentStoreCommand(this))
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -4,6 +4,6 @@ import gay.pizza.foundation.core.abstraction.Feature
|
||||
|
||||
class UpdateFeature : Feature() {
|
||||
override fun enable() {
|
||||
registerCommandExecutor("fupdate", UpdateCommand())
|
||||
plugin.registerCommandExecutor("fupdate", UpdateCommand())
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import gay.pizza.foundation.core.abstraction.Feature
|
||||
|
||||
class WorldFeature : Feature() {
|
||||
override fun enable() {
|
||||
registerCommandExecutor("setspawn", SetSpawnCommand())
|
||||
registerCommandExecutor("spawn", SpawnCommand())
|
||||
plugin.registerCommandExecutor("setspawn", SetSpawnCommand())
|
||||
plugin.registerCommandExecutor("spawn", SpawnCommand())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user