Mefedroniy color support

This commit is contained in:
pixtaded 2025-02-11 15:06:34 +03:00
parent f03666bead
commit 933af5c5e0
3 changed files with 6 additions and 9 deletions

View File

@ -10,12 +10,8 @@ public class ClientUtil {
public static final ClientColor[] colors = {
new ClientColor( COLOR_KEY + "(<.*?>)", "\033[0;31m$1\033[0m"),
new ClientColor("\uB9AC\u3E70(<.*?>)", "\033[0;32m$1\033[0m"),
new ClientColor(" (<.*?>)", " \033[0;34m$1\033[0m")
/*
I'm too lazy to add a message parser, which is absolutely required for Mefedroniy color support. For now, it will be just white.
Also, there is another problem with that - there is no "server log format" in the protocol specification,
and I want my client to be as compatible as possible.
*/
new ClientColor(" (<.*?>)", " \033[0;34m$1\033[0m"),
new ClientColor("\u00B0\u0298(<.*?>)", "\033[0;35m$1\033[0m")
};
public static String clientColors(String s) {

View File

@ -69,8 +69,9 @@ public class ServerThread implements Runnable {
}
private void sendLogs(byte PID) throws IOException {
if (PID == COMMUNICATION) respond(server.cache.content());
if (PID == LOGS) {
if (PID == COMMUNICATION) {
respond(server.cache.content());
} else if (PID == LOGS) {
String clientSize = Util.readAsciiNumber(in);
int clientSizeNum = Integer.parseInt(clientSize);
byte[] serverLogs = server.cache.content().getBytes(StandardCharsets.UTF_8);