diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/display/PacketWindowItems.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/display/PacketWindowItems.kt index 6835a32a..23bc2e59 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/display/PacketWindowItems.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/display/PacketWindowItems.kt @@ -104,7 +104,7 @@ class PacketWindowItems(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, Packe return false } - if (this.getPlugin().configYml.getBool("async-display.enabled")) { + if (this.getPlugin().configYml.getBool("async-display.always-enabled")) { return true } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/integrations/antigrief/AntigriefLands.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/integrations/antigrief/AntigriefLands.kt index 724de7f1..e1cad9f2 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/integrations/antigrief/AntigriefLands.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/spigot/integrations/antigrief/AntigriefLands.kt @@ -2,10 +2,13 @@ package com.willfp.eco.spigot.integrations.antigrief import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.integrations.antigrief.AntigriefWrapper +import me.angeschossen.lands.api.flags.Flags import me.angeschossen.lands.api.integration.LandsIntegration import org.bukkit.Location import org.bukkit.block.Block +import org.bukkit.entity.Animals import org.bukkit.entity.LivingEntity +import org.bukkit.entity.Monster import org.bukkit.entity.Player class AntigriefLands(private val plugin: EcoPlugin) : AntigriefWrapper { @@ -15,7 +18,7 @@ class AntigriefLands(private val plugin: EcoPlugin) : AntigriefWrapper { block: Block ): Boolean { val area = landsIntegration.getAreaByLoc(block.location) ?: return true - return area.isTrusted(player.uniqueId) + return area.hasFlag(player, Flags.BLOCK_BREAK, false) } override fun canCreateExplosion( @@ -23,7 +26,7 @@ class AntigriefLands(private val plugin: EcoPlugin) : AntigriefWrapper { location: Location ): Boolean { val area = landsIntegration.getAreaByLoc(location) ?: return true - return area.isTrusted(player.uniqueId) + return area.hasFlag(player, Flags.ATTACK_PLAYER, false) && area.hasFlag(player, Flags.ATTACK_ANIMAL, false) } override fun canPlaceBlock( @@ -31,15 +34,22 @@ class AntigriefLands(private val plugin: EcoPlugin) : AntigriefWrapper { block: Block ): Boolean { val area = landsIntegration.getAreaByLoc(block.location) ?: return true - return area.isTrusted(player.uniqueId) + return area.hasFlag(player, Flags.BLOCK_PLACE, false) } override fun canInjure( player: Player, victim: LivingEntity ): Boolean { + val area = landsIntegration.getAreaByLoc(victim.location) ?: return true - return area.isTrusted(player.uniqueId) + + return when(victim) { + is Player -> area.hasFlag(player, Flags.ATTACK_PLAYER, false) + is Monster -> area.hasFlag(player, Flags.ATTACK_MONSTER, false) + is Animals -> area.hasFlag(player, Flags.ATTACK_MONSTER, false) + else -> area.isTrusted(player.uniqueId) + } } override fun getPluginName(): String { diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml index 17a76f38..6e778049 100644 --- a/eco-core/core-plugin/src/main/resources/config.yml +++ b/eco-core/core-plugin/src/main/resources/config.yml @@ -48,7 +48,7 @@ display-frame-ttl: 17 # are experiencing severe display lag. async-display: # If async display should always be used. - enabled: false + always-enabled: false # Log errors that occur in async processing. log-errors: true