Format Scoreboard, fix displaying more than 15 lines
This commit is contained in:
parent
ac709d09ce
commit
1006d66e0a
@ -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++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user