diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/antigrief/AntigriefLands.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/antigrief/AntigriefLands.kt index 19d9f140..ef8de75a 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/antigrief/AntigriefLands.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/integrations/antigrief/AntigriefLands.kt @@ -3,11 +3,7 @@ package com.willfp.eco.internal.spigot.integrations.antigrief import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.integrations.antigrief.AntigriefIntegration import me.angeschossen.lands.api.LandsIntegration -import me.angeschossen.lands.api.flags.Flags -import me.angeschossen.lands.api.flags.enums.FlagTarget -import me.angeschossen.lands.api.flags.enums.RoleFlagCategory -import me.angeschossen.lands.api.flags.type.RoleFlag -import me.angeschossen.lands.api.land.Area +import me.angeschossen.lands.api.flags.type.Flags import org.bukkit.Location import org.bukkit.Material import org.bukkit.block.Block @@ -23,10 +19,7 @@ class AntigriefLands(private val plugin: EcoPlugin) : AntigriefIntegration { block: Block ): Boolean { val area = landsIntegration.getArea(block.location) ?: return true - return area.hasRoleFlag(player, RoleFlag.of(landsIntegration, - FlagTarget.PLAYER, - RoleFlagCategory.ACTION, - "BLOCK_BREAK"), block.type, false) + return area.hasRoleFlag(player, Flags.BLOCK_BREAK, block.type, false) } override fun canCreateExplosion( @@ -34,13 +27,8 @@ class AntigriefLands(private val plugin: EcoPlugin) : AntigriefIntegration { location: Location ): Boolean { val area = landsIntegration.getArea(location) ?: return true - return area.hasRoleFlag(player, RoleFlag.of(landsIntegration, - FlagTarget.PLAYER, - RoleFlagCategory.ACTION, - "ATTACK_PLAYER"), Material.AIR, false) && area.hasRoleFlag(player, RoleFlag.of(landsIntegration, - FlagTarget.PLAYER, - RoleFlagCategory.ACTION, - "ATTACK_ANIMAL"), Material.AIR, false) + return area.hasRoleFlag(player, Flags.ATTACK_PLAYER, Material.AIR, false) + && area.hasRoleFlag(player, Flags.ATTACK_ANIMAL, Material.AIR, false) } override fun canPlaceBlock( @@ -48,10 +36,7 @@ class AntigriefLands(private val plugin: EcoPlugin) : AntigriefIntegration { block: Block ): Boolean { val area = landsIntegration.getArea(block.location) ?: return true - return area.hasRoleFlag(player, RoleFlag.of(landsIntegration, - FlagTarget.PLAYER, - RoleFlagCategory.ACTION, - "BLOCK_PLACE"), Material.AIR, false) + return area.hasRoleFlag(player, Flags.BLOCK_PLACE, Material.AIR, false) } override fun canInjure( @@ -62,28 +47,16 @@ class AntigriefLands(private val plugin: EcoPlugin) : AntigriefIntegration { val area = landsIntegration.getArea(victim.location) ?: return true return when(victim) { - is Player -> area.hasRoleFlag(player, RoleFlag.of(landsIntegration, - FlagTarget.PLAYER, - RoleFlagCategory.ACTION, - "ATTACK_PLAYER"), Material.AIR, false) - is Monster -> area.hasRoleFlag(player, RoleFlag.of(landsIntegration, - FlagTarget.PLAYER, - RoleFlagCategory.ACTION, - "ATTACK_MONSTER"), Material.AIR, false) - is Animals -> area.hasRoleFlag(player, RoleFlag.of(landsIntegration, - FlagTarget.PLAYER, - RoleFlagCategory.ACTION, - "ATTACK_ANIMAL"), Material.AIR, false) + is Player -> area.hasRoleFlag(player, Flags.ATTACK_PLAYER, Material.AIR, false) + is Monster -> area.hasRoleFlag(player, Flags.ATTACK_MONSTER, Material.AIR, false) + is Animals -> area.hasRoleFlag(player, Flags.ATTACK_ANIMAL, Material.AIR, false) else -> area.isTrusted(player.uniqueId) } } override fun canPickupItem(player: Player, location: Location): Boolean { val area = landsIntegration.getArea(location) ?: return true - return area.hasRoleFlag(player, RoleFlag.of(landsIntegration, - FlagTarget.PLAYER, - RoleFlagCategory.ACTION, - "ITEM_PICKUP"), Material.AIR, false) + return area.hasRoleFlag(player, Flags.ITEM_PICKUP, Material.AIR, false) } override fun getPluginName(): String {