Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
Revert previous Server protocol check, add a call to ProtocolRegistry to force class load.
Dieser Commit ist enthalten in:
Ursprung
99e4ab22e3
Commit
3fdbf5b062
@ -7,7 +7,6 @@ import io.netty.handler.codec.ByteToMessageDecoder;
|
|||||||
import io.netty.handler.codec.MessageToByteEncoder;
|
import io.netty.handler.codec.MessageToByteEncoder;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.api.protocol.ProtocolPipeline;
|
import us.myles.ViaVersion.api.protocol.ProtocolPipeline;
|
||||||
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
|
||||||
import us.myles.ViaVersion.bukkit.classgenerator.ClassGenerator;
|
import us.myles.ViaVersion.bukkit.classgenerator.ClassGenerator;
|
||||||
import us.myles.ViaVersion.bukkit.classgenerator.HandlerConstructor;
|
import us.myles.ViaVersion.bukkit.classgenerator.HandlerConstructor;
|
||||||
|
|
||||||
@ -34,25 +33,20 @@ public class BukkitChannelInitializer extends ChannelInitializer<SocketChannel>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initChannel(SocketChannel socketChannel) throws Exception {
|
protected void initChannel(SocketChannel socketChannel) throws Exception {
|
||||||
// Ensure ViaVersion is loaded
|
UserConnection info = new UserConnection(socketChannel);
|
||||||
if (ProtocolRegistry.SERVER_PROTOCOL != -1) {
|
// init protocol
|
||||||
UserConnection info = new UserConnection(socketChannel);
|
new ProtocolPipeline(info);
|
||||||
// init protocol
|
// Add originals
|
||||||
new ProtocolPipeline(info);
|
this.method.invoke(this.original, socketChannel);
|
||||||
// Add originals
|
|
||||||
this.method.invoke(this.original, socketChannel);
|
|
||||||
|
|
||||||
HandlerConstructor constructor = ClassGenerator.getConstructor();
|
HandlerConstructor constructor = ClassGenerator.getConstructor();
|
||||||
// Add our transformers
|
// Add our transformers
|
||||||
MessageToByteEncoder encoder = constructor.newEncodeHandler(info, (MessageToByteEncoder) socketChannel.pipeline().get("encoder"));
|
MessageToByteEncoder encoder = constructor.newEncodeHandler(info, (MessageToByteEncoder) socketChannel.pipeline().get("encoder"));
|
||||||
ByteToMessageDecoder decoder = constructor.newDecodeHandler(info, (ByteToMessageDecoder) socketChannel.pipeline().get("decoder"));
|
ByteToMessageDecoder decoder = constructor.newDecodeHandler(info, (ByteToMessageDecoder) socketChannel.pipeline().get("decoder"));
|
||||||
BukkitPacketHandler chunkHandler = new BukkitPacketHandler(info);
|
BukkitPacketHandler chunkHandler = new BukkitPacketHandler(info);
|
||||||
|
|
||||||
socketChannel.pipeline().replace("encoder", "encoder", encoder);
|
socketChannel.pipeline().replace("encoder", "encoder", encoder);
|
||||||
socketChannel.pipeline().replace("decoder", "decoder", decoder);
|
socketChannel.pipeline().replace("decoder", "decoder", decoder);
|
||||||
socketChannel.pipeline().addAfter("packet_handler", "viaversion_packet_handler", chunkHandler);
|
socketChannel.pipeline().addAfter("packet_handler", "viaversion_packet_handler", chunkHandler);
|
||||||
} else {
|
|
||||||
this.method.invoke(this.original, socketChannel);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,8 @@ public class ViaManager {
|
|||||||
// Check for updates
|
// Check for updates
|
||||||
if (platform.getConf().isCheckForUpdates())
|
if (platform.getConf().isCheckForUpdates())
|
||||||
UpdateUtil.sendUpdateMessage();
|
UpdateUtil.sendUpdateMessage();
|
||||||
|
// Force class load
|
||||||
|
ProtocolRegistry.getSupportedVersions();
|
||||||
// Inject
|
// Inject
|
||||||
try {
|
try {
|
||||||
injector.inject();
|
injector.inject();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren