add timer to dragon escape
This commit is contained in:
parent
167c0f2b5e
commit
43c45f4094
@ -9,10 +9,10 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
@ -30,18 +30,21 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.block.BlockData;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.common.util.UtilTextTop;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.block.BlockData;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -50,7 +53,10 @@ import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerKitGiveEvent;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.dragonescape.kits.*;
|
||||
import nautilus.game.arcade.game.games.dragonescape.kits.KitDigger;
|
||||
import nautilus.game.arcade.game.games.dragonescape.kits.KitDisruptor;
|
||||
import nautilus.game.arcade.game.games.dragonescape.kits.KitLeaper;
|
||||
import nautilus.game.arcade.game.games.dragonescape.kits.KitWarper;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.managers.chat.ChatStatData;
|
||||
import nautilus.game.arcade.stats.DistanceTraveledStatTracker;
|
||||
@ -94,6 +100,9 @@ public class DragonEscape extends SoloGame
|
||||
private double _speedMult = 1;
|
||||
|
||||
private HashMap<BlockData, Player> _tunneled = new HashMap<BlockData, Player>();
|
||||
|
||||
private long _started;
|
||||
private long _ended;
|
||||
|
||||
public DragonEscape(ArcadeManager manager)
|
||||
{
|
||||
@ -644,4 +653,46 @@ public class DragonEscape extends SoloGame
|
||||
// Stops players using trap doors in game.
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void setTimes(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() == GameState.Live)
|
||||
{
|
||||
_started = System.currentTimeMillis();
|
||||
}
|
||||
else if (event.GetState() == GameState.End)
|
||||
{
|
||||
_ended = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateTimer(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
return;
|
||||
|
||||
if (GetState() == GameState.Prepare)
|
||||
{
|
||||
UtilTextTop.display(F.game("Game time: ") + F.time("0.0 Seconds"), UtilServer.getPlayers());
|
||||
}
|
||||
else if (GetState() == GameState.Live)
|
||||
{
|
||||
if (_started == 0)
|
||||
return;
|
||||
|
||||
UtilTextTop.display(F.game("Game time: ") + F.time(UtilTime.convertString(System.currentTimeMillis() - _started, 6, TimeUnit.SECONDS)), UtilServer.getPlayers());
|
||||
}
|
||||
else if (GetState() == GameState.End)
|
||||
{
|
||||
if (_started == 0)
|
||||
return;
|
||||
|
||||
if (_ended == 0)
|
||||
return;
|
||||
|
||||
UtilTextBottom.display(F.game("Game time: ") + F.time(UtilTime.convertString(_ended - _started, 6, TimeUnit.SECONDS)), UtilServer.getPlayers());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user