fix MAXMC-T-8
This commit is contained in:
parent
3d09b48da8
commit
6f1a727691
|
|
@ -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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue