mirror of
https://github.com/GayPizzaSpecifications/foundation.git
synced 2025-08-03 13:31:32 +00:00
Core: Add Enderman Griefing Disabler
This commit is contained in:
@ -3,6 +3,7 @@ package cloud.kubelet.foundation.core
|
|||||||
import cloud.kubelet.foundation.core.abstraction.FoundationPlugin
|
import cloud.kubelet.foundation.core.abstraction.FoundationPlugin
|
||||||
import cloud.kubelet.foundation.core.features.backup.BackupFeature
|
import cloud.kubelet.foundation.core.features.backup.BackupFeature
|
||||||
import cloud.kubelet.foundation.core.features.dev.DevFeature
|
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.player.PlayerFeature
|
||||||
import cloud.kubelet.foundation.core.features.stats.StatsFeature
|
import cloud.kubelet.foundation.core.features.stats.StatsFeature
|
||||||
import cloud.kubelet.foundation.core.features.update.UpdateFeature
|
import cloud.kubelet.foundation.core.features.update.UpdateFeature
|
||||||
@ -47,6 +48,7 @@ class FoundationCorePlugin : FoundationPlugin() {
|
|||||||
StatsFeature(),
|
StatsFeature(),
|
||||||
UpdateFeature(),
|
UpdateFeature(),
|
||||||
WorldFeature(),
|
WorldFeature(),
|
||||||
|
EndergriefFeature(),
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun createModule() = module {
|
override fun createModule() = module {
|
||||||
|
@ -10,7 +10,7 @@ import org.koin.dsl.module
|
|||||||
import org.quartz.Scheduler
|
import org.quartz.Scheduler
|
||||||
|
|
||||||
abstract class Feature : CoreFeature, KoinComponent, Listener {
|
abstract class Feature : CoreFeature, KoinComponent, Listener {
|
||||||
private val plugin by inject<FoundationCorePlugin>()
|
protected val plugin by inject<FoundationCorePlugin>()
|
||||||
protected val scheduler by inject<Scheduler>()
|
protected val scheduler by inject<Scheduler>()
|
||||||
|
|
||||||
override fun enable() {}
|
override fun enable() {}
|
||||||
|
@ -16,7 +16,6 @@ import java.net.URI
|
|||||||
import kotlin.io.path.inputStream
|
import kotlin.io.path.inputStream
|
||||||
|
|
||||||
class BackupFeature : Feature() {
|
class BackupFeature : Feature() {
|
||||||
private val plugin by inject<FoundationCorePlugin>()
|
|
||||||
private val s3Client by inject<S3Client>()
|
private val s3Client by inject<S3Client>()
|
||||||
private val config by inject<BackupConfig>()
|
private val config by inject<BackupConfig>()
|
||||||
private lateinit var scheduleId: String
|
private lateinit var scheduleId: String
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package cloud.kubelet.foundation.core.features.dev
|
package cloud.kubelet.foundation.core.features.dev
|
||||||
|
|
||||||
import cloud.kubelet.foundation.core.FoundationCorePlugin
|
|
||||||
import cloud.kubelet.foundation.core.abstraction.Feature
|
import cloud.kubelet.foundation.core.abstraction.Feature
|
||||||
import org.koin.core.component.inject
|
|
||||||
|
|
||||||
class DevFeature : Feature() {
|
class DevFeature : Feature() {
|
||||||
private val plugin = inject<FoundationCorePlugin>()
|
|
||||||
private lateinit var devUpdateServer: DevUpdateServer
|
private lateinit var devUpdateServer: DevUpdateServer
|
||||||
|
|
||||||
override fun enable() {
|
override fun enable() {
|
||||||
devUpdateServer = DevUpdateServer(plugin.value)
|
devUpdateServer = DevUpdateServer(plugin)
|
||||||
devUpdateServer.enable()
|
devUpdateServer.enable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user