mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
Fix missed diff for chat packets. Fixes BUKKIT-4666
This commit removes chat wrapping. It is no longer needed, as clients properly render lines with line breaks. This commit also changes an outgoing chat message to use the vanilla behavior for indicating a client cannot chat with commands-only setting.
This commit is contained in:
parent
0506b709fe
commit
92f111cfed
@ -715,14 +715,6 @@ public class PlayerConnection extends Connection {
|
||||
if (i == 1 && !packet3chat.isServer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
String message = packet3chat.message;
|
||||
for (final String line : org.bukkit.craftbukkit.TextWrapper.wrapText(message)) {
|
||||
this.networkManager.queue(new Packet3Chat(line));
|
||||
}
|
||||
return;
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@ -830,7 +822,7 @@ public class PlayerConnection extends Connection {
|
||||
|
||||
// CraftBukkit start
|
||||
if (this.player.getChatFlags() == 1 && !s.startsWith("/")) {
|
||||
this.sendPacket(new Packet3Chat("Cannot send chat message."));
|
||||
this.sendPacket(new Packet3Chat(ChatMessage.e("chat.cannotSend").a(EnumChatFormat.RED)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
package org.bukkit.craftbukkit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class TextWrapper {
|
||||
public static List<String> wrapText(final String text) {
|
||||
ArrayList<String> output = new ArrayList<String>();
|
||||
String[] lines = text.split("\n");
|
||||
String lastColor = null;
|
||||
|
||||
for (String line : lines) {
|
||||
if (lastColor != null) {
|
||||
line = lastColor + line;
|
||||
}
|
||||
|
||||
output.add(line);
|
||||
lastColor = ChatColor.getLastColors(line);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user