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