Rework protocol system

This commit is contained in:
md_5
2013-05-30 18:09:46 +10:00
parent ad4c143ce4
commit 2f45f0d578
40 changed files with 273 additions and 164 deletions

View File

@@ -54,7 +54,7 @@ import net.md_5.bungee.netty.PipelineUtils;
import net.md_5.bungee.protocol.packet.DefinedPacket;
import net.md_5.bungee.protocol.packet.Packet3Chat;
import net.md_5.bungee.protocol.packet.PacketFAPluginMessage;
import net.md_5.bungee.protocol.PacketDefinitions;
import net.md_5.bungee.protocol.Vanilla;
import net.md_5.bungee.scheduler.BungeeThreadPool;
import net.md_5.bungee.util.CaseInsensitiveMap;
@@ -444,13 +444,13 @@ public class BungeeCord extends ProxyServer
@Override
public byte getProtocolVersion()
{
return PacketDefinitions.PROTOCOL_VERSION;
return Vanilla.PROTOCOL_VERSION;
}
@Override
public String getGameVersion()
{
return PacketDefinitions.GAME_VERSION;
return Vanilla.GAME_VERSION;
}
@Override

View File

@@ -37,7 +37,7 @@ import net.md_5.bungee.protocol.packet.PacketFCEncryptionResponse;
import net.md_5.bungee.protocol.packet.PacketFDEncryptionRequest;
import net.md_5.bungee.protocol.packet.PacketFFKick;
import net.md_5.bungee.protocol.packet.PacketHandler;
import net.md_5.bungee.protocol.PacketDefinitions;
import net.md_5.bungee.protocol.Vanilla;
@RequiredArgsConstructor
public class ServerConnector extends PacketHandler
@@ -144,7 +144,7 @@ public class ServerConnector extends PacketHandler
login.difficulty,
login.unused,
(byte) user.getPendingConnection().getListener().getTabListSize(),
ch.getHandle().pipeline().get( PacketDecoder.class ).getProtocol() == PacketDefinitions.FORGE_PROTOCOL );
ch.getHandle().pipeline().get( PacketDecoder.class ).getProtocol() == Vanilla.FORGE_PROTOCOL );
user.sendPacket( modLogin );
} else
{
@@ -277,7 +277,7 @@ public class ServerConnector extends PacketHandler
if ( in.readByte() != 0 )
{
// TODO: Using forge flag
ch.getHandle().pipeline().get( PacketDecoder.class ).setProtocol( PacketDefinitions.FORGE_PROTOCOL );
ch.getHandle().pipeline().get( PacketDecoder.class ).setProtocol( Vanilla.FORGE_PROTOCOL );
}
}

View File

@@ -43,7 +43,7 @@ import net.md_5.bungee.protocol.packet.PacketFDEncryptionRequest;
import net.md_5.bungee.protocol.packet.PacketFEPing;
import net.md_5.bungee.protocol.packet.PacketFFKick;
import net.md_5.bungee.protocol.packet.PacketHandler;
import net.md_5.bungee.protocol.PacketDefinitions;
import net.md_5.bungee.protocol.Vanilla;
@RequiredArgsConstructor
public class InitialHandler extends PacketHandler implements PendingConnection
@@ -115,7 +115,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
Preconditions.checkState( forgeLogin == null, "Already received FORGE LOGIN" );
forgeLogin = login;
ch.getHandle().pipeline().get( PacketDecoder.class ).setProtocol( PacketDefinitions.FORGE_PROTOCOL );
ch.getHandle().pipeline().get( PacketDecoder.class ).setProtocol( Vanilla.FORGE_PROTOCOL );
}
@Override

View File

@@ -7,7 +7,7 @@ import io.netty.handler.codec.ReplayingDecoder;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import net.md_5.bungee.protocol.netty.PacketReader;
import net.md_5.bungee.protocol.skip.PacketReader;
/**
* This class will attempt to read a packet from {@link PacketReader}, with the

View File

@@ -15,7 +15,7 @@ import net.md_5.bungee.UserConnection;
import net.md_5.bungee.connection.InitialHandler;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ListenerInfo;
import net.md_5.bungee.protocol.PacketDefinitions;
import net.md_5.bungee.protocol.Vanilla;
public class PipelineUtils
{
@@ -61,7 +61,7 @@ public class PipelineUtils
ch.pipeline().addLast( "outbound", new OutboundHandler() );
ch.pipeline().addLast( "timer", new ReadTimeoutHandler( BungeeCord.getInstance().config.getTimeout(), TimeUnit.MILLISECONDS ) );
ch.pipeline().addLast( "decoder", new PacketDecoder( PacketDefinitions.VANILLA_PROTOCOL ) );
ch.pipeline().addLast( "decoder", new PacketDecoder( Vanilla.VANILLA_PROTOCOL ) );
ch.pipeline().addLast( "packet-encoder", packetEncoder );
ch.pipeline().addLast( "array-encoder", arrayEncoder );
ch.pipeline().addLast( "handler", new HandlerBoss() );