1
0
Fork 0

extend and fix pubkeys

This commit is contained in:
Sen 2025-05-29 12:51:39 +02:00
parent 5a394749bf
commit 902c795ecc
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
5 changed files with 184 additions and 64 deletions

View file

@ -513,34 +513,54 @@ public class Client implements IThreadListener {
})).channel(NioSocketChannel.class)).connect(address, serverPort).syncUninterruptibly();
return networkmanager;
}
public void displayConnecting(ServerInfo server) {
this.displayGuiScreen(GuiLoading.makeWaitTask("Verbinde zu " + (server.getAddress() == null ? "localhost" : server.getAddress()) + ":" + server.getPort() + " ..."));
}
public void connect(ServerInfo server) {
this.displayGuiScreen(GuiLoading.makeWaitTask("Verbinde zu " + (server.getAddress() == null ? "localhost" : server.getAddress()) + ":" + server.getPort() + " ..."));
public void connect(final ServerInfo server) {
this.displayConnecting(server);
Log.NETWORK.info("Verbinde zu " + (server.getAddress() == null ? "localhost" : server.getAddress()) + ":" + server.getPort());
final NetConnection connection;
try
{
connection = createNetworkManagerAndConnect(server.getAddress() == null ? InetAddress.getLoopbackAddress() : InetAddress.getByName(IDN.toASCII(server.getAddress())), server.getPort());
connection.setNetHandler(new ClientLoginHandler(connection, this, server));
connection.sendPacket(new HPacketHandshake(Util.PROTOCOL), new GenericFutureListener<Future<? super Void>>() {
public void operationComplete(Future<? super Void> u) throws Exception {
connection.setConnectionState(PacketRegistry.LOGIN);
}
});
}
catch (UnknownHostException u)
{
Log.NETWORK.error(u, "Konnte nicht zu Server verbinden");
this.disconnected("Unbekannter Hostname: " + (server.getAddress() == null ? "localhost" : server.getAddress()));
return;
}
catch (Exception e)
{
Log.NETWORK.error(e, "Konnte nicht zu Server verbinden");
this.disconnected(e.toString());
return;
}
this.connection = connection;
new Thread(new Runnable() {
public void run() {
final NetConnection connection;
try
{
connection = createNetworkManagerAndConnect(server.getAddress() == null ? InetAddress.getLoopbackAddress() : InetAddress.getByName(IDN.toASCII(server.getAddress())), server.getPort());
connection.setNetHandler(new ClientLoginHandler(connection, Client.this, server));
connection.sendPacket(new HPacketHandshake(Util.PROTOCOL), new GenericFutureListener<Future<? super Void>>() {
public void operationComplete(Future<? super Void> u) throws Exception {
connection.setConnectionState(PacketRegistry.LOGIN);
}
});
}
catch (UnknownHostException u)
{
Log.NETWORK.error(u, "Konnte nicht zu Server verbinden");
Client.this.schedule(new Runnable() {
public void run() {
Client.this.disconnected("Unbekannter Hostname: " + (server.getAddress() == null ? "localhost" : server.getAddress()));
}
});
return;
}
catch (Exception e)
{
Log.NETWORK.error(e, "Konnte nicht zu Server verbinden");
Client.this.schedule(new Runnable() {
public void run() {
Client.this.disconnected(e.toString());
}
});
return;
}
Client.this.schedule(new Runnable() {
public void run() {
Client.this.connection = connection;
}
});
}
}, "Server connector").start();
}
public void unloadWorld() {