mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-14 19:55:52 -07:00
Fixed issue with color markers in messages sent to the client.
This fix eliminates crashes related to color markers being at end-of-line, and also makes colors persist across line breaks. - The broadcast message is split up in multiple packets, one per line - Color markers are reorganized, so that color 'sticks across lines' - The wrapping method calculates the *rendered* line length. Thus, if the user has a weird font, it might look weird.
This commit is contained in:
committed by
Erik Broes
parent
09026095b6
commit
5121ebb65d
@@ -17,6 +17,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.TextWrapper;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
@@ -593,7 +594,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean chat(String msg) {
|
||||
if (msg.startsWith("/")) {
|
||||
@@ -608,12 +609,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
a.info(msg);
|
||||
this.d.f.a((Packet) (new Packet3Chat(msg)));
|
||||
for (final String line: TextWrapper.wrapText(msg)) {
|
||||
this.d.f.a((Packet) (new Packet3Chat(line)));
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
Reference in New Issue
Block a user