mirror of
https://github.com/Tiiffi/mcrcon.git
synced 2026-02-09 20:22:39 -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
|
// Add missing newlines
|
||||||
if (colors_detected == false && global_minecraft_newline_fix && data[i] == '/') {
|
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]);
|
putchar(data[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_color(default_color); // reset color
|
set_color(default_color); // reset color
|
||||||
//print_color(default_color); // cancel coloring
|
|
||||||
|
|
||||||
// print newline if string has no newline
|
// print newline if string has no newline
|
||||||
if (data[i - 1] != '\n') {
|
// if (data[i - 1] != '\n') {
|
||||||
putchar('\n');
|
// putchar('\n');
|
||||||
}
|
// }
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
@@ -739,7 +739,11 @@ int rcon_command(int sock, char *command)
|
|||||||
return 0;
|
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 (flag_silent_mode == false) {
|
||||||
if (packet->size > 10)
|
if (packet->size > 10)
|
||||||
|
|||||||
Reference in New Issue
Block a user