Core: Add Enderman Griefing Disabler

This commit is contained in:
Kenneth Endfinger
2022-01-12 23:00:03 -05:00
parent 4187b0f50c
commit 71f0b46728
5 changed files with 25 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package cloud.kubelet.foundation.core
import cloud.kubelet.foundation.core.abstraction.FoundationPlugin
import cloud.kubelet.foundation.core.features.backup.BackupFeature
import cloud.kubelet.foundation.core.features.dev.DevFeature
import cloud.kubelet.foundation.core.features.endergrief.EndergriefFeature
import cloud.kubelet.foundation.core.features.player.PlayerFeature
import cloud.kubelet.foundation.core.features.stats.StatsFeature
import cloud.kubelet.foundation.core.features.update.UpdateFeature
@ -47,6 +48,7 @@ class FoundationCorePlugin : FoundationPlugin() {
StatsFeature(),
UpdateFeature(),
WorldFeature(),
EndergriefFeature(),
)
override fun createModule() = module {

View File

@ -10,7 +10,7 @@ import org.koin.dsl.module
import org.quartz.Scheduler
abstract class Feature : CoreFeature, KoinComponent, Listener {
private val plugin by inject<FoundationCorePlugin>()
protected val plugin by inject<FoundationCorePlugin>()
protected val scheduler by inject<Scheduler>()
override fun enable() {}

View File

@ -16,7 +16,6 @@ import java.net.URI
import kotlin.io.path.inputStream
class BackupFeature : Feature() {
private val plugin by inject<FoundationCorePlugin>()
private val s3Client by inject<S3Client>()
private val config by inject<BackupConfig>()
private lateinit var scheduleId: String

View File

@ -1,15 +1,12 @@
package cloud.kubelet.foundation.core.features.dev
import cloud.kubelet.foundation.core.FoundationCorePlugin
import cloud.kubelet.foundation.core.abstraction.Feature
import org.koin.core.component.inject
class DevFeature : Feature() {
private val plugin = inject<FoundationCorePlugin>()
private lateinit var devUpdateServer: DevUpdateServer
override fun enable() {
devUpdateServer = DevUpdateServer(plugin.value)
devUpdateServer = DevUpdateServer(plugin)
devUpdateServer.enable()
}

View File

@ -0,0 +1,21 @@
package cloud.kubelet.foundation.core.features.endergrief
import cloud.kubelet.foundation.core.abstraction.Feature
import org.bukkit.entity.EntityType
import org.bukkit.event.EventHandler
import org.bukkit.event.EventPriority
import org.bukkit.event.entity.EntityChangeBlockEvent
class EndergriefFeature : Feature() {
override fun enable() {
}
override fun disable() {}
@EventHandler(priority = EventPriority.HIGHEST)
fun onEntityChangeBlock(event: EntityChangeBlockEvent) {
if (event.entity.type == EntityType.ENDERMAN) {
event.isCancelled = true
}
}
}