mirror of
https://github.com/Tiiffi/mcrcon.git
synced 2025-12-16 10:12:54 -05:00
Newline fixes:
- Add additional newline check to prevent double newlines - Print newline only after multipacket guard is received
This commit is contained in:
16
mcrcon.c
16
mcrcon.c
@@ -616,19 +616,19 @@ void packet_print(rc_packet *packet)
|
||||
|
||||
// Add missing newlines
|
||||
if (colors_detected == false && global_minecraft_newline_fix && data[i] == '/') {
|
||||
slash ? putchar('\n') : (slash = true);
|
||||
if (data[i - 1] != '\n')
|
||||
slash ? putchar('\n') : (slash = true);
|
||||
}
|
||||
|
||||
putchar(data[i]);
|
||||
}
|
||||
|
||||
set_color(default_color); // reset color
|
||||
//print_color(default_color); // cancel coloring
|
||||
|
||||
// print newline if string has no newline
|
||||
if (data[i - 1] != '\n') {
|
||||
putchar('\n');
|
||||
}
|
||||
// if (data[i - 1] != '\n') {
|
||||
// putchar('\n');
|
||||
// }
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
@@ -739,7 +739,11 @@ int rcon_command(int sock, char *command)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (packet->id == 0xBADA55) break;
|
||||
if (packet->id == 0xBADA55) {
|
||||
// Print newline after receiving multipacket guard packet
|
||||
putchar('\n');
|
||||
break;
|
||||
}
|
||||
|
||||
if (flag_silent_mode == false) {
|
||||
if (packet->size > 10)
|
||||
|
||||
Reference in New Issue
Block a user