Fix parsing bug in BaseComponent (wrong coloring)

This commit is contained in:
Bixilon 2020-12-01 15:56:50 +01:00
parent 419b3e4b02
commit 60da7c5f2b
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 6 additions and 1 deletions

View File

@ -87,5 +87,10 @@
<artifactId>commons-cli</artifactId> <artifactId>commons-cli</artifactId>
<version>1.4</version> <version>1.4</version>
</dependency> </dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline</artifactId>
<version>3.17.1</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -50,7 +50,7 @@ public class BaseComponent extends ChatComponent {
char nextFormattingChar = iterator.current(); char nextFormattingChar = iterator.current();
iterator.next(); iterator.next();
RGBColor nextColor = ChatColors.getColorByFormattingChar(nextFormattingChar); RGBColor nextColor = ChatColors.getColorByFormattingChar(nextFormattingChar);
if (nextColor != null && nextColor != color) { if (nextColor != null) {
// color change, add text part // color change, add text part
if (currentText.length() > 0) { if (currentText.length() > 0) {
parts.add(new TextComponent(currentText.toString(), color, formattingCodes)); parts.add(new TextComponent(currentText.toString(), color, formattingCodes));