Fix: Single character chat text issue fixed.

This commit is contained in:
APairOfMoons 2026-07-02 11:50:01 +08:00
parent f160ea6dc4
commit 02e3914d04

View File

@ -39,6 +39,7 @@ public class TextStyleFormatter {
String sourceLiteralText = translateInput(sourceRawText, sourcePlayer, formatsTable); String sourceLiteralText = translateInput(sourceRawText, sourcePlayer, formatsTable);
/* Debug /* Debug
sourcePlayer.sendSystemMessage(Component.literal(sourceRawText));
sourcePlayer.sendSystemMessage(Component.literal(sourceLiteralText)); sourcePlayer.sendSystemMessage(Component.literal(sourceLiteralText));
for (int i : formatsTable.keySet()) { for (int i : formatsTable.keySet()) {
ArrayList<ChatFormat> formatsList = formatsTable.get(i); ArrayList<ChatFormat> formatsList = formatsTable.get(i);
@ -120,7 +121,7 @@ public class TextStyleFormatter {
startIndex = i; startIndex = i;
} }
if (startIndex < sourceLiteralText.length() - 1) { if (startIndex < sourceLiteralText.length()) {
finalText.append(composeChatComponent( finalText.append(composeChatComponent(
sourceLiteralText.substring(startIndex, sourceLiteralText.length()), sourceLiteralText.substring(startIndex, sourceLiteralText.length()),
currentColor, currentColor,