Improved recruit/prepare countdown timers

This commit is contained in:
Chiss 2014-10-25 13:56:23 +11:00
parent bd2e7faf3e
commit cfcfad610f
2 changed files with 25 additions and 10 deletions

View File

@ -37,6 +37,7 @@ public class UtilTextTop
{
deleteOld(player);
healthPercent = Math.min(1, healthPercent);
boolean halfHealth = UtilPlayer.is1_8(player);
//Display Dragon

View File

@ -10,6 +10,7 @@ import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
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.minecraft.game.core.condition.Condition.ConditionType;
@ -62,7 +63,7 @@ public class GameManager implements Listener
if (event.getType() != UpdateType.FASTER)
return;
if (Manager.GetGame() != null && Manager.GetGame().GetState() != GameState.Live)
if (Manager.GetGame() != null && !Manager.GetGame().InProgress())
{
ChatColor col = ChatColor.RED;
if (_colorId == 1) col = ChatColor.YELLOW;
@ -73,19 +74,16 @@ public class GameManager implements Listener
String text = col + C.Bold + "US.MINEPLEX.COM EU.MINEPLEX.COM";
double health = 1;
if (Manager.GetGame().GetState() == GameState.Prepare)
if (Manager.GetGame().GetState() == GameState.Recruit)
{
health = (9 - (System.currentTimeMillis() - Manager.GetGame().GetStateTime())/1000d) / 9d;
}
else if (Manager.GetGame().GetState() == GameState.Recruit)
{
if (Manager.GetGame().GetCountdown() >= 0)
health = Manager.GetGame().GetCountdown() / 60d;
if (Manager.GetGame().GetCountdown() >= 0 && Manager.GetGame().GetCountdown() <= 10)
health = 1 - Manager.GetGame().GetCountdown() / 10d;
}
//Display IP
UtilTextTop.display(text, UtilServer.getPlayers());
UtilTextTop.displayProgress(text, health, UtilServer.getPlayers());
//Name Dragons Appropriately
for (Mount mount : Manager.getCosmeticManager().getMountManager().getMounts())
{
if (mount instanceof MountDragon)
@ -97,6 +95,22 @@ public class GameManager implements Listener
}
}
@EventHandler
public void DisplayPrepareTime(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (Manager.GetGame() == null || Manager.GetGame().GetState() != GameState.Prepare)
return;
double health = (9 - (System.currentTimeMillis() - Manager.GetGame().GetStateTime())/1000d) / 9d;
for (Player player : UtilServer.getPlayers())
UtilTextBottom.displayProgress("Game Start", 1-health,
UtilTime.MakeStr(Math.max(0, 9000 - (System.currentTimeMillis() - Manager.GetGame().GetStateTime()))), player);
}
@EventHandler
public void StateUpdate(UpdateEvent event)
{