Correct format for hour
This commit is contained in:
@@ -50,12 +50,14 @@ public class ClientConnexion implements PacketVisitor, PacketHandler{
|
|||||||
public void visitPacket(ChatMessagePacket packet) {
|
public void visitPacket(ChatMessagePacket packet) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
String time = packet.getTime().toString();
|
String time = packet.getTime().toString();
|
||||||
|
sb.append("&y[");
|
||||||
sb.append(time, 11, 19); // We only take the HH:MM:SS part
|
sb.append(time, 11, 19); // We only take the HH:MM:SS part
|
||||||
|
sb.append("]&n");
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
sb.append(packet.getChatter());
|
sb.append(packet.getChatter());
|
||||||
sb.append(" : ");
|
sb.append(" : ");
|
||||||
sb.append(ANSIColor.formatString(packet.getContent() + "&n")); // make the color back to normal at the end of every message
|
sb.append(packet.getContent()).append("&n"); // make the color back to normal at the end of every message
|
||||||
System.out.println(sb);
|
System.out.println(ANSIColor.formatString(sb.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -6,11 +6,13 @@ public class ANSIColor {
|
|||||||
public static final String RED = "\u001B[31m";
|
public static final String RED = "\u001B[31m";
|
||||||
public static final String GREEN = "\u001B[32m";
|
public static final String GREEN = "\u001B[32m";
|
||||||
public static final String BLUE = "\u001B[34m";
|
public static final String BLUE = "\u001B[34m";
|
||||||
|
public static final String GREY = "\u001B[37m";
|
||||||
|
|
||||||
public static String formatString(String message){
|
public static String formatString(String message){
|
||||||
return message.replace("&r", RED)
|
return message.replace("&r", RED)
|
||||||
.replace("&g", GREEN)
|
.replace("&g", GREEN)
|
||||||
.replace("&b", BLUE)
|
.replace("&b", BLUE)
|
||||||
|
.replace("&y", GREY)
|
||||||
.replace("&n", RESET);
|
.replace("&n", RESET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user