fix MAXMC-T-6
This commit is contained in:
parent
7f4ef2a447
commit
9416250e13
|
|
@ -7,13 +7,18 @@ import cc.maxmc.blastingcrisis.misc.GameManager
|
||||||
import cc.maxmc.blastingcrisis.misc.debug
|
import cc.maxmc.blastingcrisis.misc.debug
|
||||||
import cc.maxmc.blastingcrisis.misc.toPlayerLocation
|
import cc.maxmc.blastingcrisis.misc.toPlayerLocation
|
||||||
import org.bukkit.Location
|
import org.bukkit.Location
|
||||||
|
import org.bukkit.entity.Player
|
||||||
import org.bukkit.event.block.BlockBreakEvent
|
import org.bukkit.event.block.BlockBreakEvent
|
||||||
import org.bukkit.event.block.BlockPlaceEvent
|
import org.bukkit.event.block.BlockPlaceEvent
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent
|
import org.bukkit.event.entity.EntityExplodeEvent
|
||||||
|
import org.bukkit.event.entity.FoodLevelChangeEvent
|
||||||
import org.bukkit.event.player.PlayerInteractEvent
|
import org.bukkit.event.player.PlayerInteractEvent
|
||||||
import org.bukkit.event.player.PlayerMoveEvent
|
import org.bukkit.event.player.PlayerMoveEvent
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent
|
import org.bukkit.event.player.PlayerRespawnEvent
|
||||||
import taboolib.common.platform.event.SubscribeEvent
|
import taboolib.common.platform.event.SubscribeEvent
|
||||||
|
import taboolib.platform.util.feed
|
||||||
|
import taboolib.platform.util.saturate
|
||||||
import taboolib.platform.util.sendLang
|
import taboolib.platform.util.sendLang
|
||||||
|
|
||||||
object GameListener {
|
object GameListener {
|
||||||
|
|
@ -70,4 +75,20 @@ object GameListener {
|
||||||
val team = respawnEvent.player.team ?: return // ignore none game player
|
val team = respawnEvent.player.team ?: return // ignore none game player
|
||||||
respawnEvent.respawnLocation = team.teamInfo.spawn.toPlayerLocation()
|
respawnEvent.respawnLocation = team.teamInfo.spawn.toPlayerLocation()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
fun protectDamageBeforeGame(damageEvent: EntityDamageEvent) {
|
||||||
|
if (damageEvent.entity !is Player) return // ignore none player entity
|
||||||
|
if (GameManager.currentGame.state.isStarted()) return
|
||||||
|
damageEvent.isCancelled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
fun protectHunger(hungerEvent: FoodLevelChangeEvent) {
|
||||||
|
hungerEvent.isCancelled = true
|
||||||
|
hungerEvent.entity.run {
|
||||||
|
feed()
|
||||||
|
saturate()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue