Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4102be1201 | ||
|
|
f6bdb9cc65 | ||
|
|
c8282d1acf | ||
|
|
b056b537ef | ||
|
|
f69b458731 |
@@ -3,9 +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.enums.FlagTarget
|
||||
import me.angeschossen.lands.api.flags.enums.RoleFlagCategory
|
||||
import me.angeschossen.lands.api.flags.type.RoleFlag
|
||||
import me.angeschossen.lands.api.flags.type.Flags
|
||||
import org.bukkit.Location
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.block.Block
|
||||
@@ -21,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(
|
||||
@@ -32,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(
|
||||
@@ -46,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(
|
||||
@@ -60,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 {
|
||||
|
||||
@@ -36,22 +36,22 @@ class ShopEconomyShopGUI : ShopIntegration {
|
||||
|
||||
object EconomyShopGUISellEventListeners : Listener {
|
||||
private val sellTypes = listOf(
|
||||
Transaction.Type.SELL_GUI_SCREEN,
|
||||
Transaction.Type.SELL_SCREEN,
|
||||
Transaction.Type.SELL_ALL_SCREEN,
|
||||
Transaction.Type.SELL_ALL_COMMAND,
|
||||
Transaction.Type.QUICK_SELL,
|
||||
Transaction.Type.AUTO_SELL_CHEST,
|
||||
"SELL_GUI_SCREEN",
|
||||
"SELL_SCREEN",
|
||||
"SELL_ALL_SCREEN",
|
||||
"SELL_ALL_COMMAND",
|
||||
"QUICK_SELL",
|
||||
"AUTO_SELL_CHEST",
|
||||
)
|
||||
|
||||
private val sellAllTypes = listOf(
|
||||
Transaction.Type.SELL_GUI_SCREEN,
|
||||
Transaction.Type.SELL_ALL_COMMAND,
|
||||
"SELL_GUI_SCREEN",
|
||||
"SELL_ALL_COMMAND",
|
||||
)
|
||||
|
||||
@EventHandler
|
||||
fun shopEventToEcoEvent(event: PreTransactionEvent) {
|
||||
if (event.transactionType !in sellTypes) {
|
||||
if (event.transactionType.name.uppercase() !in sellTypes) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class ShopEconomyShopGUI : ShopIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
val prices = if (event.transactionType in sellAllTypes) {
|
||||
val prices = if (event.transactionType.name.uppercase() in sellAllTypes) {
|
||||
event.items!!
|
||||
} else {
|
||||
mapOf(event.shopItem to event.amount)
|
||||
|
||||
@@ -45,6 +45,7 @@ softdepend:
|
||||
- ExecutableItems
|
||||
- RPGHorses
|
||||
- EconomyShopGUI
|
||||
- EconomyShopGUI-Premium
|
||||
- zShop
|
||||
- DeluxeSellwands
|
||||
- Scyther
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version = 6.50.0
|
||||
version = 6.50.1
|
||||
plugin-name = eco
|
||||
kotlin.code.style = official
|
||||
Reference in New Issue
Block a user