Merge pull request #35 from dimadencep/velocity-tools
Compat with velocity-tools
This commit is contained in:
commit
fbc15bc4c8
|
|
@ -17,10 +17,12 @@ public class VelocityServerChannelInitializer extends ServerChannelInitializer {
|
|||
private Method INIT_CHANNEL;
|
||||
|
||||
private final ChannelInitializer<?> delegate;
|
||||
private final VelocityServer server;
|
||||
|
||||
public VelocityServerChannelInitializer(ChannelInitializer<?> delegate,VelocityServer server) {
|
||||
super(server);
|
||||
this.delegate = delegate;
|
||||
this.server = server;
|
||||
try {
|
||||
INIT_CHANNEL = delegate.getClass().getDeclaredMethod("initChannel", Channel.class);
|
||||
INIT_CHANNEL.setAccessible(true);
|
||||
|
|
@ -41,7 +43,7 @@ public class VelocityServerChannelInitializer extends ServerChannelInitializer {
|
|||
super.initChannel(ch);
|
||||
MinecraftConnection handler = ch.pipeline().get(MinecraftConnection.class);
|
||||
HandshakeSessionHandler originalSessionHandler = (HandshakeSessionHandler) handler.getSessionHandler();
|
||||
handler.setSessionHandler(new VelocityHandshakeSessionHandler(originalSessionHandler, handler));
|
||||
handler.setSessionHandler(new VelocityHandshakeSessionHandler(originalSessionHandler, handler, server));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package org.adde0109.ambassador.velocity.client;
|
||||
|
||||
import com.velocitypowered.proxy.VelocityServer;
|
||||
import com.velocitypowered.proxy.connection.ConnectionTypes;
|
||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||
import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
|
||||
import com.velocitypowered.proxy.connection.client.HandshakeSessionHandler;
|
||||
import com.velocitypowered.proxy.network.Connections;
|
||||
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
||||
|
|
@ -11,11 +11,12 @@ import com.velocitypowered.proxy.protocol.packet.Handshake;
|
|||
import io.netty.buffer.ByteBuf;
|
||||
import org.adde0109.ambassador.forge.ForgeConstants;
|
||||
|
||||
public class VelocityHandshakeSessionHandler implements MinecraftSessionHandler {
|
||||
public class VelocityHandshakeSessionHandler extends HandshakeSessionHandler {
|
||||
private final HandshakeSessionHandler original;
|
||||
private final MinecraftConnection connection;
|
||||
|
||||
public VelocityHandshakeSessionHandler(HandshakeSessionHandler original, MinecraftConnection connection) {
|
||||
public VelocityHandshakeSessionHandler(HandshakeSessionHandler original, MinecraftConnection connection, VelocityServer server) {
|
||||
super(connection, server);
|
||||
this.original = original;
|
||||
this.connection = connection;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user