UHC: Add 20 seconds of invincibility on game start

This commit is contained in:
libraryaddict 2015-05-14 14:29:30 +12:00
parent 4bc38e3396
commit 0fc1d680af

View File

@ -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)
{