From 0fc1d680af1d663ec40febb915c2765d769163f0 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 14 May 2015 14:29:30 +1200 Subject: [PATCH] UHC: Add 20 seconds of invincibility on game start --- .../game/arcade/game/games/uhc/UHC.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 4e6eb86f5..85a62be1d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -43,7 +43,6 @@ import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; -import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.ItemStack; @@ -83,10 +82,8 @@ import mineplex.serverdata.Utility; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.Kit; public class UHC extends TeamGame @@ -231,6 +228,23 @@ public class UHC extends TeamGame } } + @EventHandler + public void onDamage(CustomDamageEvent event) + { + if (!IsLive()) + return; + + if (UtilTime.elapsed(getGameLiveTime(), 20000)) + return; + + if (!(event.GetDamageeEntity() instanceof Player)) + return; + + event.SetCancelled("Spawn Invincibility"); + event.GetDamageeEntity().setFireTicks(0); + + } + @EventHandler public void onSecond(UpdateEvent event) {