mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-23 18:55:22 +01:00
Minecraft 24w13a support
This commit is contained in:
parent
db623d10c5
commit
e642b9dde1
@ -5,6 +5,7 @@ import net.md_5.bungee.protocol.packet.Chat;
|
||||
import net.md_5.bungee.protocol.packet.ClearTitles;
|
||||
import net.md_5.bungee.protocol.packet.ClientChat;
|
||||
import net.md_5.bungee.protocol.packet.ClientCommand;
|
||||
import net.md_5.bungee.protocol.packet.ClientCommandSigned;
|
||||
import net.md_5.bungee.protocol.packet.ClientSettings;
|
||||
import net.md_5.bungee.protocol.packet.ClientStatus;
|
||||
import net.md_5.bungee.protocol.packet.Commands;
|
||||
@ -104,6 +105,10 @@ public abstract class AbstractPacketHandler
|
||||
{
|
||||
}
|
||||
|
||||
public void handle(ClientCommandSigned command) throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public void handle(Respawn respawn) throws Exception
|
||||
{
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import net.md_5.bungee.protocol.packet.Chat;
|
||||
import net.md_5.bungee.protocol.packet.ClearTitles;
|
||||
import net.md_5.bungee.protocol.packet.ClientChat;
|
||||
import net.md_5.bungee.protocol.packet.ClientCommand;
|
||||
import net.md_5.bungee.protocol.packet.ClientCommandSigned;
|
||||
import net.md_5.bungee.protocol.packet.ClientSettings;
|
||||
import net.md_5.bungee.protocol.packet.Commands;
|
||||
import net.md_5.bungee.protocol.packet.CookieRequest;
|
||||
@ -513,7 +514,7 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_19_4, 0x12 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_20_2, 0x14 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_20_3, 0x15 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x17 )
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x18 )
|
||||
);
|
||||
TO_SERVER.registerPacket( Chat.class,
|
||||
Chat::new,
|
||||
@ -530,11 +531,17 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_19, 0x03 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x04 )
|
||||
);
|
||||
TO_SERVER.registerPacket(
|
||||
ClientCommandSigned.class,
|
||||
ClientCommandSigned::new,
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x05 )
|
||||
);
|
||||
TO_SERVER.registerPacket(
|
||||
ClientChat.class,
|
||||
ClientChat::new,
|
||||
map( ProtocolConstants.MINECRAFT_1_19, 0x04 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x05 )
|
||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x05 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x06 )
|
||||
);
|
||||
TO_SERVER.registerPacket(
|
||||
TabCompleteRequest.class,
|
||||
@ -549,7 +556,8 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x09 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_19_3, 0x08 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_19_4, 0x09 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_20_2, 0x0A )
|
||||
map( ProtocolConstants.MINECRAFT_1_20_2, 0x0A ),
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x0B )
|
||||
);
|
||||
TO_SERVER.registerPacket(
|
||||
ClientSettings.class,
|
||||
@ -563,7 +571,8 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x08 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_19_3, 0x07 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_19_4, 0x08 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_20_2, 0x09 )
|
||||
map( ProtocolConstants.MINECRAFT_1_20_2, 0x09 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x0A )
|
||||
);
|
||||
TO_SERVER.registerPacket(
|
||||
PluginMessage.class,
|
||||
@ -581,17 +590,18 @@ public enum Protocol
|
||||
map( ProtocolConstants.MINECRAFT_1_19_4, 0x0D ),
|
||||
map( ProtocolConstants.MINECRAFT_1_20_2, 0x0F ),
|
||||
map( ProtocolConstants.MINECRAFT_1_20_3, 0x10 ),
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x11 )
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x12 )
|
||||
);
|
||||
TO_SERVER.registerPacket(
|
||||
StartConfiguration.class,
|
||||
StartConfiguration::new,
|
||||
map( ProtocolConstants.MINECRAFT_1_20_2, 0x0B )
|
||||
map( ProtocolConstants.MINECRAFT_1_20_2, 0x0B ),
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x0C )
|
||||
);
|
||||
TO_SERVER.registerPacket(
|
||||
CookieResponse.class,
|
||||
CookieResponse::new,
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x10 )
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x11 )
|
||||
);
|
||||
}
|
||||
},
|
||||
@ -724,12 +734,12 @@ public enum Protocol
|
||||
TO_CLIENT.registerPacket(
|
||||
StoreCookie.class,
|
||||
StoreCookie::new,
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x09 )
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x0A )
|
||||
);
|
||||
TO_CLIENT.registerPacket(
|
||||
Transfer.class,
|
||||
Transfer::new,
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x0A )
|
||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x0B )
|
||||
);
|
||||
|
||||
TO_SERVER.registerPacket(
|
||||
|
@ -45,7 +45,7 @@ public class ProtocolConstants
|
||||
public static final int MINECRAFT_1_20 = 763;
|
||||
public static final int MINECRAFT_1_20_2 = 764;
|
||||
public static final int MINECRAFT_1_20_3 = 765;
|
||||
public static final int MINECRAFT_1_20_5 = 1073742005;
|
||||
public static final int MINECRAFT_1_20_5 = 1073742006;
|
||||
public static final List<String> SUPPORTED_VERSIONS;
|
||||
public static final List<Integer> SUPPORTED_VERSION_IDS;
|
||||
|
||||
|
@ -33,6 +33,11 @@ public class ClientCommand extends DefinedPacket
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
command = readString( buf, 256 );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
timestamp = buf.readLong();
|
||||
salt = buf.readLong();
|
||||
|
||||
@ -74,6 +79,11 @@ public class ClientCommand extends DefinedPacket
|
||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
writeString( command, buf );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
buf.writeLong( timestamp );
|
||||
buf.writeLong( salt );
|
||||
|
||||
|
@ -0,0 +1,111 @@
|
||||
package net.md_5.bungee.protocol.packet;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.md_5.bungee.protocol.AbstractPacketHandler;
|
||||
import net.md_5.bungee.protocol.ChatChain;
|
||||
import net.md_5.bungee.protocol.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
import net.md_5.bungee.protocol.SeenMessages;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ClientCommandSigned extends DefinedPacket
|
||||
{
|
||||
|
||||
private String command;
|
||||
private long timestamp;
|
||||
private long salt;
|
||||
private Map<String, byte[]> signatures;
|
||||
private boolean signedPreview;
|
||||
private ChatChain chain;
|
||||
private SeenMessages seenMessages;
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
command = readString( buf, 256 );
|
||||
timestamp = buf.readLong();
|
||||
salt = buf.readLong();
|
||||
|
||||
int cnt = readVarInt( buf );
|
||||
Preconditions.checkArgument( cnt <= 8, "Too many signatures" );
|
||||
signatures = new HashMap<>( cnt );
|
||||
for ( int i = 0; i < cnt; i++ )
|
||||
{
|
||||
String name = readString( buf, 16 );
|
||||
byte[] signature;
|
||||
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||
{
|
||||
signature = new byte[ 256 ];
|
||||
buf.readBytes( signature );
|
||||
} else
|
||||
{
|
||||
signature = readArray( buf );
|
||||
}
|
||||
signatures.put( name, signature );
|
||||
}
|
||||
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_19_3 )
|
||||
{
|
||||
signedPreview = buf.readBoolean();
|
||||
}
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||
{
|
||||
seenMessages = new SeenMessages();
|
||||
seenMessages.read( buf, direction, protocolVersion );
|
||||
} else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||
{
|
||||
chain = new ChatChain();
|
||||
chain.read( buf, direction, protocolVersion );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
writeString( command, buf );
|
||||
buf.writeLong( timestamp );
|
||||
buf.writeLong( salt );
|
||||
|
||||
writeVarInt( signatures.size(), buf );
|
||||
for ( Map.Entry<String, byte[]> entry : signatures.entrySet() )
|
||||
{
|
||||
writeString( entry.getKey(), buf );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||
{
|
||||
buf.writeBytes( entry.getValue() );
|
||||
} else
|
||||
{
|
||||
writeArray( entry.getValue(), buf );
|
||||
}
|
||||
}
|
||||
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_19_3 )
|
||||
{
|
||||
buf.writeBoolean( signedPreview );
|
||||
}
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||
{
|
||||
seenMessages.write( buf, direction, protocolVersion );
|
||||
} else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||
{
|
||||
chain.write( buf, direction, protocolVersion );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(AbstractPacketHandler handler) throws Exception
|
||||
{
|
||||
handler.handle( this );
|
||||
}
|
||||
}
|
@ -31,6 +31,7 @@ import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
import net.md_5.bungee.protocol.packet.Chat;
|
||||
import net.md_5.bungee.protocol.packet.ClientChat;
|
||||
import net.md_5.bungee.protocol.packet.ClientCommand;
|
||||
import net.md_5.bungee.protocol.packet.ClientCommandSigned;
|
||||
import net.md_5.bungee.protocol.packet.ClientSettings;
|
||||
import net.md_5.bungee.protocol.packet.CookieResponse;
|
||||
import net.md_5.bungee.protocol.packet.FinishConfiguration;
|
||||
@ -196,6 +197,12 @@ public class UpstreamBridge extends PacketHandler
|
||||
handleChat( "/" + command.getCommand() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(ClientCommandSigned command) throws Exception
|
||||
{
|
||||
handleChat( "/" + command.getCommand() );
|
||||
}
|
||||
|
||||
private String handleChat(String message)
|
||||
{
|
||||
for ( int index = 0, length = message.length(); index < length; index++ )
|
||||
|
@ -22,7 +22,7 @@ class EntityMap_1_16_2 extends EntityMap
|
||||
static final EntityMap_1_16_2 INSTANCE_1_19_4 = new EntityMap_1_16_2( 0x03, 0x30 );
|
||||
static final EntityMap_1_16_2 INSTANCE_1_20_2 = new EntityMap_1_16_2( -1, 0x33 );
|
||||
static final EntityMap_1_16_2 INSTANCE_1_20_3 = new EntityMap_1_16_2( -1, 0x34 );
|
||||
static final EntityMap_1_16_2 INSTANCE_1_20_5 = new EntityMap_1_16_2( -1, 0x36 );
|
||||
static final EntityMap_1_16_2 INSTANCE_1_20_5 = new EntityMap_1_16_2( -1, 0x37 );
|
||||
//
|
||||
private final int spawnPlayerId;
|
||||
private final int spectateId;
|
||||
|
Loading…
Reference in New Issue
Block a user