diff --git a/src/main/kotlin/cc/maxmc/blastingcrisis/game/GamePlaceBreakRule.kt b/src/main/kotlin/cc/maxmc/blastingcrisis/game/GamePlaceBreakRule.kt index c97343e..c2faf4e 100644 --- a/src/main/kotlin/cc/maxmc/blastingcrisis/game/GamePlaceBreakRule.kt +++ b/src/main/kotlin/cc/maxmc/blastingcrisis/game/GamePlaceBreakRule.kt @@ -1,6 +1,7 @@ package cc.maxmc.blastingcrisis.game import cc.maxmc.blastingcrisis.game.GamePlaceBreakRule.ActionType.BREAK +import cc.maxmc.blastingcrisis.game.GamePlaceBreakRule.ActionType.PLACE import cc.maxmc.blastingcrisis.misc.debug import org.bukkit.Location import org.bukkit.entity.Player @@ -55,5 +56,17 @@ class GamePlaceBreakRule(val game: Game) { val isHome = team.teamInfo.wall.containsBlock(loc) (type == BREAK) xor isHome } + + addRule("allow_tnt_conditional") { player, type, loc -> + if (type != PLACE) return@addRule true + val team = player.team ?: return@addRule false + val isHome = game.teams + .map { + it.teamInfo.home.containsBlock(loc).also { result -> debug("area ${it.teamInfo.home} contains $loc is $result") } + } + .reduce { a, b -> a || b } + if (!isHome) return@addRule false + return@addRule !team.teamInfo.home.containsBlock(loc) + } } } \ No newline at end of file