Improving TeamSurvivalGames Scoreboard.

This commit is contained in:
Sarah 2015-07-14 05:44:58 +02:00
parent e72d612379
commit 304a51de04

View File

@ -3,6 +3,9 @@ package nautilus.game.arcade.game.games.survivalgames;
import java.util.ArrayList;
import java.util.List;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
@ -116,35 +119,51 @@ public class TeamSurvivalGames extends SurvivalGames
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event != null && event.getType() != UpdateType.FAST)
if (event.getType() != UpdateType.FAST)
return;
if (GetTeamList().isEmpty())
return;
Scoreboard.Reset();
for (GameTeam team : this.GetTeamList())
Scoreboard.WriteBlank();
Scoreboard.Write(C.cGreen + C.Bold + "Time");
Scoreboard.Write(UtilTime.convertString(this.getSecondsSinceStart() * 1000, 0, TimeUnit.FIT));
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Teams");
if (GetTeamList().size() > 7)
{
//Display Individual Players
if (this.GetPlayers(true).size() < 13)
Scoreboard.Write("" + GetTeamList().size());
}
else
{
for (GameTeam team : GetTeamList())
{
if (!team.IsTeamAlive())
continue;
Scoreboard.WriteBlank();
for (Player player : team.GetPlayers(true))
{
Scoreboard.Write(team.GetColor() + player.getName());
}
Scoreboard.Write(C.cWhite + team.GetColor() + team.GetName());
}
}
//Display Players Alive
else
{
Scoreboard.WriteBlank();
Scoreboard.WriteBlank();
Scoreboard.Write(team.GetColor() + team.GetName());
Scoreboard.Write(team.GetPlayers(true).size() + "" + team.GetColor() + " Alive");
}
if (this.getChestRefillTime() > 0 && this.getDeathMatchTime() > 60)
{
Scoreboard.Write(C.cGold + C.Bold + "Chest Refill");
Scoreboard.Write(UtilTime.convertString(this.getChestRefillTime() * 1000, 0, TimeUnit.FIT));
}
else if (this.getDeathMatchTime() > 0)
{
Scoreboard.Write(C.cRed + C.Bold + "Deathmatch");
Scoreboard.Write(UtilTime.convertString(
Math.min(this.getDeathMatchTime(), this.isDeathMatchTeleported() ? 10 : this.getDeathMatchTime()) * 1000, 0, TimeUnit.FIT));
}
else
{
Scoreboard.Write(C.cRed + C.Bold + "Game End");
Scoreboard.Write(UtilTime.convertString(Math.max(0, this.getGameEndTime()) * 1000, 0, TimeUnit.FIT));
}
Scoreboard.Draw();