Format Scoreboard, fix displaying more than 15 lines

This commit is contained in:
libraryaddict 2015-01-12 12:09:45 +13:00
parent ac709d09ce
commit 1006d66e0a

View File

@ -262,10 +262,13 @@ public class GameScoreboard
int i = 0;
while (true)
{
if (i >= _chars.length)
if (i >= 15 || i >= _chars.length)
break;
String str = ChatColor.COLOR_CHAR + "" + _chars[i] + ChatColor.RESET;
Score score = GetObjectiveSide().getScore(str);
if (newLines.size() <= i)
{
if (score.isScoreSet())
@ -280,23 +283,31 @@ public class GameScoreboard
else
{
Team team = GetScoreboard().getTeam(str);
if (team == null)
{
team = GetScoreboard().registerNewTeam(str);
team.addEntry(str);
}
String line = newLines.get(i);
team.setPrefix(line.substring(0, Math.min(line.length(), 16)));
team.setSuffix(ChatColor.getLastColors(line) + line.substring(team.getPrefix().length()));
if (!score.isScoreSet())
{
if (i == 15)
{
score.setScore(1);
}
score.setScore(15 - i);
}
}
i++;
}
}