Will do final tests tomorrow, but all seems to work. Yay for efficiency and options for plugin developers!
This commit is contained in:
@@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf;
|
||||
import lombok.Getter;
|
||||
import net.md_5.bungee.protocol.packet.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.packet.forge.Forge1Login;
|
||||
import net.md_5.bungee.protocol.skip.PacketReader;
|
||||
|
||||
public class Forge extends Vanilla
|
||||
{
|
||||
@@ -11,9 +12,10 @@ public class Forge extends Vanilla
|
||||
@Getter
|
||||
private static final Forge instance = new Forge();
|
||||
|
||||
|
||||
public Forge()
|
||||
{
|
||||
classes[0x01] = Forge1Login.class;
|
||||
skipper = new PacketReader( this ); // TODO: :(
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -43,10 +43,10 @@ public class Vanilla implements Protocol
|
||||
@Getter
|
||||
private Constructor<? extends DefinedPacket>[] constructors = new Constructor[ 256 ];
|
||||
@Getter
|
||||
private final PacketReader skipper = new PacketReader( this );
|
||||
protected PacketReader skipper;
|
||||
/*========================================================================*/
|
||||
|
||||
|
||||
public Vanilla()
|
||||
{
|
||||
classes[0x00] = Packet0KeepAlive.class;
|
||||
classes[0x01] = Packet1Login.class;
|
||||
@@ -65,6 +65,7 @@ public class Vanilla implements Protocol
|
||||
classes[0xFD] = PacketFDEncryptionRequest.class;
|
||||
classes[0xFE] = PacketFEPing.class;
|
||||
classes[0xFF] = PacketFFKick.class;
|
||||
skipper = new PacketReader( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -39,7 +39,7 @@ public abstract class DefinedPacket
|
||||
public void writeArray(byte[] b, ByteBuf buf)
|
||||
{
|
||||
// TODO: Check len - use Guava?
|
||||
buf.writeByte( b.length );
|
||||
buf.writeShort( b.length );
|
||||
buf.writeBytes( b );
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@ public class Packet1Login extends DefinedPacket
|
||||
|
||||
public Packet1Login(int entityId, String levelType, byte gameMode, byte dimension, byte difficulty, byte unused, byte maxPlayers)
|
||||
{
|
||||
this( entityId, levelType, gameMode, entityId, difficulty, unused, maxPlayers );
|
||||
this( entityId, levelType, gameMode, (int) dimension, difficulty, unused, maxPlayers );
|
||||
}
|
||||
|
||||
public Packet1Login(int entityId, String levelType, byte gameMode, int dimension, byte difficulty, byte unused, byte maxPlayers)
|
||||
|
@@ -13,14 +13,14 @@ public class PacketC9PlayerListItem extends DefinedPacket
|
||||
|
||||
private String username;
|
||||
private boolean online;
|
||||
private int ping;
|
||||
private short ping;
|
||||
|
||||
private PacketC9PlayerListItem()
|
||||
{
|
||||
super( 0xC9 );
|
||||
}
|
||||
|
||||
public PacketC9PlayerListItem(String username, boolean online, int ping)
|
||||
public PacketC9PlayerListItem(String username, boolean online, short ping)
|
||||
{
|
||||
super( 0xC9 );
|
||||
this.username = username;
|
||||
@@ -33,7 +33,7 @@ public class PacketC9PlayerListItem extends DefinedPacket
|
||||
{
|
||||
username = readString( buf );
|
||||
online = buf.readBoolean();
|
||||
ping = buf.readInt();
|
||||
ping = buf.readShort();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,7 +41,7 @@ public class PacketC9PlayerListItem extends DefinedPacket
|
||||
{
|
||||
writeString( username, buf );
|
||||
buf.writeBoolean( online );
|
||||
buf.writeInt( ping );
|
||||
buf.writeShort(ping );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -33,7 +33,7 @@ public class PacketCCSettings extends DefinedPacket
|
||||
@Override
|
||||
public void write(ByteBuf buf)
|
||||
{
|
||||
locale = readString( buf );
|
||||
writeString( locale, buf );
|
||||
buf.writeByte( viewDistance );
|
||||
buf.writeByte( chatFlags );
|
||||
buf.writeByte( difficulty );
|
||||
|
Reference in New Issue
Block a user