diff --git a/src/main/java/de/bixilon/minosoft/Minosoft.java b/src/main/java/de/bixilon/minosoft/Minosoft.java index a32af1446..f170d758d 100644 --- a/src/main/java/de/bixilon/minosoft/Minosoft.java +++ b/src/main/java/de/bixilon/minosoft/Minosoft.java @@ -68,7 +68,6 @@ public class Minosoft { checkClientToken(); - Connection c = new Connection(config.getString("debug.host")); accountList = config.getMojangAccounts(); if (accountList.size() == 0) { /* @@ -84,7 +83,7 @@ public class Minosoft { } else { Log.mojang("Could not refresh session, you will not be able to join premium servers!"); } - c.setPlayer(new Player(account)); + Connection c = new Connection(1, config.getString("debug.host"), new Player(account)); c.resolve(ConnectionReason.CONNECT); // resolve dns address and connect } diff --git a/src/main/java/de/bixilon/minosoft/logging/Log.java b/src/main/java/de/bixilon/minosoft/logging/Log.java index 6db31e2c5..82fa64676 100644 --- a/src/main/java/de/bixilon/minosoft/logging/Log.java +++ b/src/main/java/de/bixilon/minosoft/logging/Log.java @@ -34,6 +34,8 @@ public class Log { builder.append("["); builder.append(timeFormat.format(System.currentTimeMillis())); builder.append("] ["); + builder.append(Thread.currentThread().getName()); + builder.append("] ["); builder.append(l.name()); builder.append("] "); if (color != null && Config.colorLog) { @@ -67,7 +69,7 @@ public class Log { } } }); - logThread.setName("Log-Thread"); + logThread.setName("Log"); logThread.start(); } diff --git a/src/main/java/de/bixilon/minosoft/protocol/network/Connection.java b/src/main/java/de/bixilon/minosoft/protocol/network/Connection.java index 2ecc6c324..8b75ca6ef 100644 --- a/src/main/java/de/bixilon/minosoft/protocol/network/Connection.java +++ b/src/main/java/de/bixilon/minosoft/protocol/network/Connection.java @@ -45,18 +45,21 @@ public class Connection { final PacketSender sender; final ArrayList handlingQueue; final VelocityHandler velocityHandler = new VelocityHandler(this); + final int connectionId; ServerAddress address; PluginChannelHandler pluginChannelHandler; Thread handleThread; Version version = Versions.getLowestVersionSupported(); // default final CustomMapping customMapping = new CustomMapping(version); - Player player; + final Player player; ConnectionState state = ConnectionState.DISCONNECTED; ConnectionReason reason; ConnectionReason nextReason; ConnectionPing connectionStatusPing; - public Connection(String hostname) { + public Connection(int connectionId, String hostname, Player player) { + this.connectionId = connectionId; + this.player = player; try { addresses = DNSUtil.getServerAddresses(hostname); } catch (TextParseException e) { @@ -216,10 +219,6 @@ public class Connection { return player; } - public void setPlayer(Player player) { - this.player = player; - } - public void sendPacket(ServerboundPacket p) { network.sendPacket(p); } @@ -245,7 +244,7 @@ public class Connection { } } }); - handleThread.setName("Handle-Thread"); + handleThread.setName(String.format("%d/Handling", connectionId)); handleThread.start(); } @@ -323,4 +322,8 @@ public class Connection { public VelocityHandler getVelocityHandler() { return velocityHandler; } + + public int getConnectionId() { + return connectionId; + } } diff --git a/src/main/java/de/bixilon/minosoft/protocol/network/Network.java b/src/main/java/de/bixilon/minosoft/protocol/network/Network.java index 12168e2ff..969f5ac61 100644 --- a/src/main/java/de/bixilon/minosoft/protocol/network/Network.java +++ b/src/main/java/de/bixilon/minosoft/protocol/network/Network.java @@ -208,7 +208,7 @@ public class Network { e.printStackTrace(); } }); - socketThread.setName("Socket-Thread"); + socketThread.setName(String.format("%d/Socket", connection.getConnectionId())); socketThread.start(); }