mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 03:25:15 +01:00
Handle ChatColor-ending messages FIXES BUKKIT-4924
Now adds the component upon creation, eliminating issues where the created component was discarded.
This commit is contained in:
parent
72b36b8b07
commit
46c11eb83f
@ -32,9 +32,10 @@ public final class CraftChatMessage {
|
|||||||
|
|
||||||
private FromString(String message) {
|
private FromString(String message) {
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
output = new IChatBaseComponent[] { new ChatComponentText("") };
|
output = new IChatBaseComponent[] { currentChatComponent };
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
list.add(currentChatComponent);
|
||||||
|
|
||||||
EnumChatFormat format = null;
|
EnumChatFormat format = null;
|
||||||
|
|
||||||
@ -73,19 +74,16 @@ public final class CraftChatMessage {
|
|||||||
i++;
|
i++;
|
||||||
} else if (currentChar == '\n') {
|
} else if (currentChar == '\n') {
|
||||||
if (builder.length() > 0) {
|
if (builder.length() > 0) {
|
||||||
finishComponent();
|
appendNewComponent();
|
||||||
}
|
}
|
||||||
|
currentChatComponent = null;
|
||||||
} else {
|
} else {
|
||||||
builder.append(currentChar);
|
builder.append(currentChar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (builder.length() > 0) {
|
if (builder.length() > 0) {
|
||||||
finishComponent();
|
appendNewComponent();
|
||||||
}
|
|
||||||
|
|
||||||
if (list.isEmpty()) {
|
|
||||||
list.add(new ChatComponentText(""));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
output = list.toArray(new IChatBaseComponent[0]);
|
output = list.toArray(new IChatBaseComponent[0]);
|
||||||
@ -95,13 +93,11 @@ public final class CraftChatMessage {
|
|||||||
IChatBaseComponent addition = new ChatComponentText(builder.toString()).setChatModifier(modifier);
|
IChatBaseComponent addition = new ChatComponentText(builder.toString()).setChatModifier(modifier);
|
||||||
builder = new StringBuilder();
|
builder = new StringBuilder();
|
||||||
modifier = modifier.clone();
|
modifier = modifier.clone();
|
||||||
currentChatComponent = currentChatComponent.a(addition);
|
if (currentChatComponent == null) {
|
||||||
}
|
currentChatComponent = new ChatComponentText("");
|
||||||
|
list.add(currentChatComponent);
|
||||||
private void finishComponent() {
|
}
|
||||||
appendNewComponent();
|
currentChatComponent.a(addition);
|
||||||
list.add(currentChatComponent);
|
|
||||||
currentChatComponent = new ChatComponentText("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IChatBaseComponent[] getOutput() {
|
private IChatBaseComponent[] getOutput() {
|
||||||
|
Loading…
Reference in New Issue
Block a user