mirror of
https://github.com/GayPizzaSpecifications/foundation.git
synced 2025-08-03 05:30:55 +00:00
Fix bugs in the usage of koin.
This commit is contained in:
@ -52,12 +52,10 @@ class GameplayFeature : Feature() {
|
||||
private fun onPlayerInteractEntity(event: PlayerInteractEntityEvent) {
|
||||
val mainHandItem = event.player.inventory.itemInMainHand
|
||||
val hasLead = mainHandItem.type == Material.LEAD
|
||||
val isLivingEntity = event.rightClicked is LivingEntity
|
||||
val livingEntity = event.rightClicked as? LivingEntity
|
||||
|
||||
// If leads are allowed on all mobs, then start leading the mob.
|
||||
if (config.mobs.allowLeads && hasLead && isLivingEntity) {
|
||||
val livingEntity = event.rightClicked as LivingEntity
|
||||
|
||||
if (config.mobs.allowLeads && hasLead && livingEntity != null) {
|
||||
// Something to do with Bukkit, leashes must happen after the event.
|
||||
Bukkit.getScheduler().runTask(plugin) { ->
|
||||
// If the entity is already leashed, don't do anything.
|
||||
|
@ -8,14 +8,14 @@ import org.koin.core.module.Module
|
||||
import org.koin.dsl.module
|
||||
|
||||
class PersistenceFeature : Feature() {
|
||||
private val persistence = inject<PluginPersistence>()
|
||||
private val core = inject<FoundationCorePlugin>()
|
||||
private val persistence by inject<PluginPersistence>()
|
||||
private val core by inject<FoundationCorePlugin>()
|
||||
|
||||
override fun disable() {
|
||||
persistence.value.unload()
|
||||
persistence.unload()
|
||||
}
|
||||
|
||||
override fun module(): Module = module {
|
||||
single { core.value.persistence }
|
||||
single { core.persistence }
|
||||
}
|
||||
}
|
||||
|
@ -13,11 +13,11 @@ import java.time.Instant
|
||||
|
||||
@Suppress("IdentifierGrammar")
|
||||
class StatsFeature : Feature() {
|
||||
internal val persistence = inject<PluginPersistence>()
|
||||
internal val persistence by inject<PluginPersistence>()
|
||||
private lateinit var chatLogStore: PersistentStore
|
||||
|
||||
override fun enable() {
|
||||
chatLogStore = persistence.value.store("chat-logs")
|
||||
chatLogStore = persistence.store("chat-logs")
|
||||
|
||||
plugin.registerCommandExecutor(listOf("leaderboard", "lb"), LeaderboardCommand())
|
||||
plugin.registerCommandExecutor("pstore", PersistentStoreCommand(this))
|
||||
|
Reference in New Issue
Block a user