Change scoreboard to use new system

This commit is contained in:
Sam 2016-08-15 20:28:12 +01:00
parent 6839006bd1
commit dac4d9595c
2 changed files with 29 additions and 31 deletions

View File

@ -18,6 +18,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import mineplex.core.common.Pair;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
@ -110,7 +111,7 @@ public class Quiver extends SoloGame
this.DeathSpectateSecs = 1;
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy");
_scoreObj = Scoreboard.getScoreboard().registerNewObjective("Kills", "dummy");
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
}
@ -311,17 +312,14 @@ public class Quiver extends SoloGame
SortScores();
//Wipe Last
Scoreboard.Reset();
Scoreboard.reset();
Scoreboard.WriteBlank();
Scoreboard.writeNewLine();
//Write New
for (QuiverScore score : _ranks)
{
Scoreboard.WriteOrdered("Score", C.cGreen + score.Player.getName(), score.Kills, true);
}
Scoreboard.writeGroup(_ranks, score -> Pair.create(C.cGreen + score.Player.getName(), score.Kills), true);
Scoreboard.Draw();
Scoreboard.draw();
}
@EventHandler

View File

@ -168,48 +168,48 @@ public class QuiverPayload extends TeamGame
return;
}
Scoreboard.Reset();
Scoreboard.WriteBlank();
Scoreboard.reset();
Scoreboard.writeNewLine();
Scoreboard.Write(C.cGoldB + "Payload");
Scoreboard.write(C.cGoldB + "Payload");
if (_contested)
{
Scoreboard.Write(C.cDPurpleB + "Contested");
Scoreboard.write(C.cDPurpleB + "Contested");
}
else if (_teamDirection != null)
{
String distance = new DecimalFormat("0.0").format(getTrackDistanceToMarker(getDestination(_teamDirection)));
Scoreboard.Write(_teamDirection.GetFormattedName() + ChatColor.RESET + _teamDirection.GetColor() + " (" + _teamDirection.GetColor() + distance + "m)");
Scoreboard.write(_teamDirection.GetFormattedName() + ChatColor.RESET + _teamDirection.GetColor() + " (" + _teamDirection.GetColor() + distance + "m)");
}
else
{
Scoreboard.Write("None");
Scoreboard.write("None");
}
if (IsLive())
{
Scoreboard.WriteBlank();
Scoreboard.writeNewLine();
// Scoreboard.Write(C.cGreenB + "Next Speed Increase");
// Scoreboard.Write(UtilTime.MakeStr(PAYLOAD_VELOCITY_INCREASE_TIME - (System.currentTimeMillis() - _lastSpeedIncrease)));
// Scoreboard.write(C.cGreenB + "Next Speed Increase");
// Scoreboard.write(UtilTime.MakeStr(PAYLOAD_VELOCITY_INCREASE_TIME - (System.currentTimeMillis() - _lastSpeedIncrease)));
Scoreboard.Write(C.cRedB + "Team Red");
Scoreboard.Write(String.valueOf(teamAScore));
Scoreboard.write(C.cRedB + "Team Red");
Scoreboard.write(String.valueOf(teamAScore));
Scoreboard.WriteBlank();
Scoreboard.writeNewLine();
Scoreboard.Write(C.cAquaB + "Team Blue");
Scoreboard.Write(String.valueOf(teamBScore));
Scoreboard.write(C.cAquaB + "Team Blue");
Scoreboard.write(String.valueOf(teamBScore));
Scoreboard.WriteBlank();
Scoreboard.writeNewLine();
Scoreboard.Write(C.cRedB + "Game End");
Scoreboard.Write(UtilTime.MakeStr(GAME_TIMEOUT - (System.currentTimeMillis() - GetStateTime())));
Scoreboard.write(C.cRedB + "Game End");
Scoreboard.write(UtilTime.MakeStr(GAME_TIMEOUT - (System.currentTimeMillis() - GetStateTime())));
}
Scoreboard.WriteBlank();
Scoreboard.Draw();
Scoreboard.writeNewLine();
Scoreboard.draw();
}
@EventHandler
@ -218,7 +218,7 @@ public class QuiverPayload extends TeamGame
if (event.GetState() == GameState.Prepare)
{
// This hides all nametags of the enemy teams.
for (Team team : Scoreboard.GetScoreboard().getTeams())
for (Team team : Scoreboard.getScoreboard().getTeams())
{
team.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
}
@ -1000,8 +1000,8 @@ public class QuiverPayload extends TeamGame
{
String minecartID = _minecart.getUniqueId().toString();
GetScoreboard().GetScoreboard().getTeam("RED").removeEntry(minecartID);
GetScoreboard().GetScoreboard().getTeam("BLUE").removeEntry(minecartID);
GetScoreboard().getScoreboard().getTeam("RED").removeEntry(minecartID);
GetScoreboard().getScoreboard().getTeam("BLUE").removeEntry(minecartID);
if (gameTeam == null)
{
@ -1010,7 +1010,7 @@ public class QuiverPayload extends TeamGame
String added = GetTeamList().get(0).equals(gameTeam) ? "RED" : "BLUE";
GetScoreboard().GetScoreboard().getTeam(added).addEntry(minecartID);
GetScoreboard().getScoreboard().getTeam(added).addEntry(minecartID);
}
public String getTopBar(int teamACount, int teamBCount)