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. By: David Flemström <david.flemstrom@gmail.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import net.minecraft.server.WorldServer;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.TextWrapper;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -80,7 +81,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
public void sendMessage(String message) {
|
||||
entity.a.b(new Packet3Chat(message));
|
||||
for (final String line: TextWrapper.wrapText(message)) {
|
||||
entity.a.b(new Packet3Chat(line));
|
||||
}
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
|
||||
Reference in New Issue
Block a user