downgrade netty to old version to fix annoying network bugs WHYYYYYYYYYYYYYYYYYYYYY?!?!?!?!

This commit is contained in:
Sen 2025-05-25 17:53:55 +02:00
parent 10fdaf0b1a
commit 77b5a34a33
15 changed files with 51 additions and 220 deletions

View file

@ -71,6 +71,7 @@ import client.renderer.texture.EntityTexManager;
import client.renderer.texture.TextureManager;
import client.renderer.texture.TextureMap;
import client.util.FileUtils;
import client.util.Message;
import client.util.PerfSection;
import client.util.PlayerController;
import client.vars.BoolVar;
@ -129,19 +130,18 @@ import common.item.ItemControl;
import common.item.ItemStack;
import common.log.Log;
import common.log.LogLevel;
import common.log.Message;
import common.network.IThreadListener;
import common.network.NetConnection;
import common.network.PacketDecoder;
import common.network.PacketEncoder;
import common.network.PacketPrepender;
import common.network.PacketRegistry;
import common.network.PacketSplitter;
import common.network.NetHandler.ThreadQuickExitException;
import common.packet.CPacketAction;
import common.packet.CPacketCheat;
import common.packet.CPacketMessage;
import common.packet.HPacketHandshake;
import common.packet.LPacketLogin;
import common.packet.CPacketAction.Action;
import common.potion.Potion;
import common.potion.PotionEffect;
@ -171,6 +171,8 @@ import io.netty.channel.ChannelOption;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.timeout.ReadTimeoutHandler;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
/*
Een net ganz funktionierndes Programm ...
@ -513,13 +515,16 @@ public class Client implements IThreadListener {
public void connect(String address, int port, String user, String pass, String access) {
this.displayGuiScreen(GuiLoading.makeWaitTask("Verbinde zu " + (address == null ? "localhost" : address) + ":" + port + " ..."));
Log.JNI.info("Verbinde zu " + (address == null ? "localhost" : address) + ":" + port);
NetConnection connection = null;
final NetConnection connection;
try
{
connection = createNetworkManagerAndConnect(address == null ? InetAddress.getLoopbackAddress() : InetAddress.getByName(IDN.toASCII(address)), port);
connection.setNetHandler(new ClientLoginHandler(connection, this, user, access, pass));
connection.sendPacket(new HPacketHandshake(Config.PROTOCOL));
connection.sendPacket(new LPacketLogin());
connection.sendPacket(new HPacketHandshake(Config.PROTOCOL), new GenericFutureListener<Future<? super Void>>() {
public void operationComplete(Future<? super Void> u) throws Exception {
connection.setConnectionState(PacketRegistry.LOGIN);
}
});
}
catch (UnknownHostException u)
{
@ -793,8 +798,10 @@ public class Client implements IThreadListener {
}
else if (this.connection != null)
{
this.connection.processReceivedPackets();
this.connection.checkDisconnected();
if(this.connection.isChannelOpen())
this.connection.processReceivedPackets();
else
this.connection.checkDisconnected();
}
}
@ -2649,9 +2656,21 @@ public class Client implements IThreadListener {
});
this.registerDebug(Keysym.AE, "Programm sofort beenden und server beenden", new DebugRunner() {
public void execute(Keysym key) {
if(Client.this.player != null)
Client.this.player.client.addToSendQueue(new CPacketMessage(CPacketMessage.Type.COMMAND, "shutdown"));
Client.this.interrupted = true;
if(Client.this.getNetHandler() != null) {
Client.this.getNetHandler().getNetworkManager().sendPacket(new CPacketMessage(CPacketMessage.Type.COMMAND, "shutdown"), new GenericFutureListener<Future<? super Void>>() {
public void operationComplete(Future<? super Void> u) throws Exception {
try {
Thread.sleep(1000L);
}
catch(InterruptedException e) {
}
Client.this.interrupted = true;
}
});
}
else {
Client.this.interrupted = true;
}
}
});
}

View file

@ -18,7 +18,7 @@ public class GuiInfo extends Gui {
private static final String[] LIBRARIES = {
"LWJGL 3.3.6+1 (GLFW + OpenGL)",
"Netty 4.1.119-Final"
"Netty 4.0.23-Final"
};
private static final String[] CODE = {
"Albert Pham - WorldEdit (Snippets)",

View file

@ -45,6 +45,7 @@ public class ClientLoginHandler extends NetHandler implements IClientLoginHandle
}
public void handleEncrypt(RPacketRequestEncrypt packet) {
this.networkManager.setConnectionState(PacketRegistry.LOGIN);
final SecretKey secret = EncryptUtil.createNewSharedKey();
PublicKey pubkey = packet.getKey();
this.networkManager.sendPacket(new LPacketStartEncrypt(secret, pubkey, packet.getToken()), new GenericFutureListener < Future <? super Void >> () {

View file

@ -0,0 +1,11 @@
package client.util;
public class Message {
public final String message;
public final long time;
public Message(String message, long time) {
this.message = message;
this.time = time;
}
}