fix MAXMC-T-8

This commit is contained in:
TONY_All 2023-06-16 01:56:10 +08:00
parent 3d09b48da8
commit 6f1a727691
Signed by: tony_all
GPG Key ID: 08A2261D5D6F746A
1 changed files with 13 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package cc.maxmc.blastingcrisis.game package cc.maxmc.blastingcrisis.game
import cc.maxmc.blastingcrisis.game.GamePlaceBreakRule.ActionType.BREAK import cc.maxmc.blastingcrisis.game.GamePlaceBreakRule.ActionType.BREAK
import cc.maxmc.blastingcrisis.game.GamePlaceBreakRule.ActionType.PLACE
import cc.maxmc.blastingcrisis.misc.debug import cc.maxmc.blastingcrisis.misc.debug
import org.bukkit.Location import org.bukkit.Location
import org.bukkit.entity.Player import org.bukkit.entity.Player
@ -55,5 +56,17 @@ class GamePlaceBreakRule(val game: Game) {
val isHome = team.teamInfo.wall.containsBlock(loc) val isHome = team.teamInfo.wall.containsBlock(loc)
(type == BREAK) xor isHome (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)
}
} }
} }