add thread name to logger for some reaosn lol

This commit is contained in:
ChomeNS
2023-07-16 14:24:25 +07:00
parent 2fd4fda4ed
commit e981d17fff
2 changed files with 7 additions and 3 deletions

View File

@@ -63,9 +63,10 @@ public class LoggerPlugin extends ChatPlugin.Listener {
LocalDateTime dateTime = LocalDateTime.now();
final Component message = Component.translatable(
"[%s %s] [%s] %s",
"[%s %s] [%s] [%s] %s",
Component.text(dateTime.format(dateTimeFormatter)).color(NamedTextColor.GRAY),
prefix,
Component.text(Thread.currentThread().getName()).color(NamedTextColor.GRAY),
Component.text(bot.options.serverName).color(NamedTextColor.GRAY),
Component.text(_message).color(NamedTextColor.WHITE)
).color(NamedTextColor.DARK_GRAY);

View File

@@ -89,7 +89,7 @@ public class VoiceChatPlugin extends Bot.Listener {
e.printStackTrace();
}
new Thread(() -> {
final Thread thread = new Thread(() -> {
sendToServer(new NetworkMessage(new AuthenticatePacket(initializationData.playerUUID, initializationData.secret)));
while (running) {
@@ -106,7 +106,10 @@ public class VoiceChatPlugin extends Bot.Listener {
else break; // is this neccessary?
}
}
}).start();
});
thread.setName("Simple Voice Chat Thread");
thread.start();
} else if (_packet.getChannel().equals("voicechat:add_group")) {
final byte[] bytes = _packet.getData();
final FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(bytes));