Created
July 15, 2018 21:21
-
-
Save negativems/68eaa5f25f17821bbef75ffbee1edfdf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Team team = scoreboard.getTeam("team-"+index) == null ? scoreboard.registerNewTeam("team-"+index) : scoreboard.getTeam("team-"+index); | |
String prefix = ""; | |
String entry = ""; | |
String suffix = ""; | |
Iterator<String> iterator = Splitter.fixedLength(16).split(line).iterator(); | |
prefix = iterator.next(); | |
entry = iterator.next(); | |
if (iterator.hasNext()) suffix = iterator.next(); | |
if (prefix.charAt(prefix.length()-1) == 38){ | |
if (entry.length() < 16){ | |
line = line.substring(0,14)+"&r"+line.substring(14); | |
} | |
} | |
iterator = Splitter.fixedLength(16).split(line).iterator(); | |
prefix = iterator.next(); | |
entry = iterator.next(); | |
if (iterator.hasNext()) suffix = iterator.next(); | |
String lastPrefixColor = Color.getLastColor(prefix,false); | |
String firstEntryColor = Color.getFirstColor(entry,false); | |
if (firstEntryColor != ""){ //Si existe un primer color en el entry: | |
if (entry.indexOf(firstEntryColor) == 0){ //Si el primer color del entry es el primer carácter: | |
line = line.substring(0,16)+Color.getColorByNumber(index)+firstEntryColor+line.substring(18); | |
}else{ //Si el primer color del entry no es el primer carácter. | |
if (lastPrefixColor != ""){ //Si existe un último color en el prefix: | |
line = line.substring(0,16)+Color.getColorByNumber(index)+lastPrefixColor+line.substring(16); | |
}else{ //Si no hay ningun color en el prefix y el primer color del entry no es el primer carácter: | |
line = line.substring(0,16)+Color.getColorByNumber(index)+"&r"+line.substring(16); | |
} | |
} | |
}else{ //Si no existe ninún color en el entry: | |
if (lastPrefixColor != ""){ //Si existe un último color en el prefix: | |
line = line.substring(0,16)+Color.getColorByNumber(index)+lastPrefixColor+line.substring(16); | |
}else{ //Si no existe ningún color ni en el prefix ni en el entry | |
line = line.substring(0,16)+Color.getColorByNumber(index)+"&r"+line.substring(16); | |
} | |
} | |
iterator = Splitter.fixedLength(16).split(line).iterator(); | |
prefix = iterator.next(); | |
entry = iterator.next(); | |
if (iterator.hasNext()) suffix = iterator.next(); | |
team.setPrefix(Color.formatColor(prefix)); | |
team.addEntry(Color.formatColor(entry)); | |
team.setSuffix(Color.formatColor(suffix)); | |
objective.getScore(Color.formatColor(entry)).setScore(index); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment