Minecraft 1.19.1 support
This commit is contained in:
parent
adc32d5a5c
commit
78ca16dfe3
@ -23,7 +23,6 @@ import net.md_5.bungee.protocol.packet.LoginPayloadResponse;
|
|||||||
import net.md_5.bungee.protocol.packet.LoginRequest;
|
import net.md_5.bungee.protocol.packet.LoginRequest;
|
||||||
import net.md_5.bungee.protocol.packet.LoginSuccess;
|
import net.md_5.bungee.protocol.packet.LoginSuccess;
|
||||||
import net.md_5.bungee.protocol.packet.PingPacket;
|
import net.md_5.bungee.protocol.packet.PingPacket;
|
||||||
import net.md_5.bungee.protocol.packet.PlayerChat;
|
|
||||||
import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter;
|
import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter;
|
||||||
import net.md_5.bungee.protocol.packet.PlayerListItem;
|
import net.md_5.bungee.protocol.packet.PlayerListItem;
|
||||||
import net.md_5.bungee.protocol.packet.PluginMessage;
|
import net.md_5.bungee.protocol.packet.PluginMessage;
|
||||||
@ -86,10 +85,6 @@ public abstract class AbstractPacketHandler
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handle(PlayerChat chat) throws Exception
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handle(SystemChat chat) throws Exception
|
public void handle(SystemChat chat) throws Exception
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,82 @@
|
|||||||
|
package net.md_5.bungee.protocol;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public class ChatChain extends DefinedPacket
|
||||||
|
{
|
||||||
|
|
||||||
|
private List<ChainLink> seen;
|
||||||
|
private List<ChainLink> received;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
|
{
|
||||||
|
seen = readLinks( buf );
|
||||||
|
if ( buf.readBoolean() )
|
||||||
|
{
|
||||||
|
received = readLinks( buf );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<ChainLink> readLinks(ByteBuf buf)
|
||||||
|
{
|
||||||
|
int cnt = readVarInt( buf );
|
||||||
|
Preconditions.checkArgument( cnt <= 5, "Too many entries" );
|
||||||
|
List<ChainLink> chain = new LinkedList<>();
|
||||||
|
for ( int i = 0; i < cnt; i++ )
|
||||||
|
{
|
||||||
|
chain.add( new ChainLink( readUUID( buf ), readArray( buf ) ) );
|
||||||
|
}
|
||||||
|
return chain;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
|
{
|
||||||
|
writeLinks( seen, buf );
|
||||||
|
if ( received != null )
|
||||||
|
{
|
||||||
|
buf.writeBoolean( true );
|
||||||
|
writeLinks( received, buf );
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
buf.writeBoolean( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void writeLinks(List<ChainLink> links, ByteBuf buf)
|
||||||
|
{
|
||||||
|
writeVarInt( links.size(), buf );
|
||||||
|
for ( ChainLink link : links )
|
||||||
|
{
|
||||||
|
writeUUID( link.sender, buf );
|
||||||
|
writeArray( link.signature, buf );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(AbstractPacketHandler handler) throws Exception
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException( "Not supported." );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class ChainLink
|
||||||
|
{
|
||||||
|
|
||||||
|
private final UUID sender;
|
||||||
|
private final byte[] signature;
|
||||||
|
}
|
||||||
|
}
|
@ -29,7 +29,6 @@ import net.md_5.bungee.protocol.packet.LoginPayloadResponse;
|
|||||||
import net.md_5.bungee.protocol.packet.LoginRequest;
|
import net.md_5.bungee.protocol.packet.LoginRequest;
|
||||||
import net.md_5.bungee.protocol.packet.LoginSuccess;
|
import net.md_5.bungee.protocol.packet.LoginSuccess;
|
||||||
import net.md_5.bungee.protocol.packet.PingPacket;
|
import net.md_5.bungee.protocol.packet.PingPacket;
|
||||||
import net.md_5.bungee.protocol.packet.PlayerChat;
|
|
||||||
import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter;
|
import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter;
|
||||||
import net.md_5.bungee.protocol.packet.PlayerListItem;
|
import net.md_5.bungee.protocol.packet.PlayerListItem;
|
||||||
import net.md_5.bungee.protocol.packet.PluginMessage;
|
import net.md_5.bungee.protocol.packet.PluginMessage;
|
||||||
@ -80,7 +79,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x20 ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x20 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x1F ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x1F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x21 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x21 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x1E )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x1E ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x20 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Login.class,
|
Login.class,
|
||||||
@ -92,7 +92,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x25 ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x25 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x24 ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x24 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x26 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x26 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x23 )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x23 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x25 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket( Chat.class,
|
TO_CLIENT.registerPacket( Chat.class,
|
||||||
Chat::new,
|
Chat::new,
|
||||||
@ -117,7 +118,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x3A ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x3A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x39 ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x39 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x3D ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x3D ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x3B )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x3B ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x3E )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
BossBar.class,
|
BossBar.class,
|
||||||
@ -128,11 +130,6 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x0D ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x0D ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x0A )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x0A )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
|
||||||
PlayerChat.class,
|
|
||||||
PlayerChat::new,
|
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x30 )
|
|
||||||
);
|
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
PlayerListItem.class, // PlayerInfo
|
PlayerListItem.class, // PlayerInfo
|
||||||
PlayerListItem::new,
|
PlayerListItem::new,
|
||||||
@ -145,7 +142,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x33 ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x33 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x32 ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x32 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x36 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x36 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x34 )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x34 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x37 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
TabCompleteResponse.class,
|
TabCompleteResponse.class,
|
||||||
@ -169,7 +167,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_13, 0x45 ),
|
map( ProtocolConstants.MINECRAFT_1_13, 0x45 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x49 ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x49 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_15, 0x4A ),
|
map( ProtocolConstants.MINECRAFT_1_15, 0x4A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x53 )
|
map( ProtocolConstants.MINECRAFT_1_17, 0x53 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x56 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
ScoreboardScore.class,
|
ScoreboardScore.class,
|
||||||
@ -181,7 +180,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_13, 0x48 ),
|
map( ProtocolConstants.MINECRAFT_1_13, 0x48 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x4C ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x4C ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_15, 0x4D ),
|
map( ProtocolConstants.MINECRAFT_1_15, 0x4D ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x56 )
|
map( ProtocolConstants.MINECRAFT_1_17, 0x56 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x59 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
ScoreboardDisplay.class,
|
ScoreboardDisplay.class,
|
||||||
@ -193,7 +193,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_13, 0x3E ),
|
map( ProtocolConstants.MINECRAFT_1_13, 0x3E ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x42 ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x42 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_15, 0x43 ),
|
map( ProtocolConstants.MINECRAFT_1_15, 0x43 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x4C )
|
map( ProtocolConstants.MINECRAFT_1_17, 0x4C ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x4F )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Team.class,
|
Team.class,
|
||||||
@ -205,7 +206,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_13, 0x47 ),
|
map( ProtocolConstants.MINECRAFT_1_13, 0x47 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x4B ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x4B ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_15, 0x4C ),
|
map( ProtocolConstants.MINECRAFT_1_15, 0x4C ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x55 )
|
map( ProtocolConstants.MINECRAFT_1_17, 0x55 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x58 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
PluginMessage.class,
|
PluginMessage.class,
|
||||||
@ -218,7 +220,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x18 ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x18 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x17 ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x17 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x18 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x18 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x15 )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x15 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x16 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Kick.class,
|
Kick.class,
|
||||||
@ -231,7 +234,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x1A ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x1A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x19 ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x19 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x1A ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x1A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x17 )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x17 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x19 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Title.class,
|
Title.class,
|
||||||
@ -244,7 +248,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_15, 0x50 ),
|
map( ProtocolConstants.MINECRAFT_1_15, 0x50 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x4F ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x4F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x59 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x59 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_18, 0x5A )
|
map( ProtocolConstants.MINECRAFT_1_18, 0x5A ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5D )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
ClearTitles.class,
|
ClearTitles.class,
|
||||||
@ -256,18 +261,21 @@ public enum Protocol
|
|||||||
Subtitle.class,
|
Subtitle.class,
|
||||||
Subtitle::new,
|
Subtitle::new,
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x57 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x57 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_18, 0x58 )
|
map( ProtocolConstants.MINECRAFT_1_18, 0x58 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5B )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
TitleTimes.class,
|
TitleTimes.class,
|
||||||
TitleTimes::new,
|
TitleTimes::new,
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x5A ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x5A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_18, 0x5B )
|
map( ProtocolConstants.MINECRAFT_1_18, 0x5B ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5E )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
SystemChat.class,
|
SystemChat.class,
|
||||||
SystemChat::new,
|
SystemChat::new,
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x5F )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x5F ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x62 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
PlayerListHeaderFooter.class,
|
PlayerListHeaderFooter.class,
|
||||||
@ -283,7 +291,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x53 ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x53 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x5E ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x5E ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_18, 0x5F ),
|
map( ProtocolConstants.MINECRAFT_1_18, 0x5F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x60 )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x60 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x63 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
EntityStatus.class,
|
EntityStatus.class,
|
||||||
@ -296,7 +305,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x1B ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x1B ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x1A ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x1A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x1B ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x1B ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x18 )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x18 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x1A )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Commands.class,
|
Commands.class,
|
||||||
@ -315,7 +325,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x1E ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x1E ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x1D ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x1D ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x1E ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x1E ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x1B )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x1B ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x1D )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
ViewDistance.class,
|
ViewDistance.class,
|
||||||
@ -324,7 +335,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_15, 0x42 ),
|
map( ProtocolConstants.MINECRAFT_1_15, 0x42 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x41 ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x41 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x4A ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x4A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x49 )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x49 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x4C )
|
||||||
);
|
);
|
||||||
|
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
@ -338,7 +350,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x0F ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x0F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x10 ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x10 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x0F ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x0F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x11 )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x11 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x12 )
|
||||||
);
|
);
|
||||||
TO_SERVER.registerPacket( Chat.class,
|
TO_SERVER.registerPacket( Chat.class,
|
||||||
Chat::new,
|
Chat::new,
|
||||||
@ -352,12 +365,14 @@ public enum Protocol
|
|||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
ClientCommand.class,
|
ClientCommand.class,
|
||||||
ClientCommand::new,
|
ClientCommand::new,
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x03 )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x03 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x04 )
|
||||||
);
|
);
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
ClientChat.class,
|
ClientChat.class,
|
||||||
ClientChat::new,
|
ClientChat::new,
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x04 )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x04 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x05 )
|
||||||
);
|
);
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
TabCompleteRequest.class,
|
TabCompleteRequest.class,
|
||||||
@ -368,7 +383,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_12_1, 0x01 ),
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x01 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_13, 0x05 ),
|
map( ProtocolConstants.MINECRAFT_1_13, 0x05 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x06 ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x06 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x08 )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x08 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x09 )
|
||||||
);
|
);
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
ClientSettings.class,
|
ClientSettings.class,
|
||||||
@ -378,7 +394,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_12, 0x05 ),
|
map( ProtocolConstants.MINECRAFT_1_12, 0x05 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_12_1, 0x04 ),
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x04 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x05 ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x05 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x07 )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x07 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x08 )
|
||||||
);
|
);
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
PluginMessage.class,
|
PluginMessage.class,
|
||||||
@ -390,7 +407,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_13, 0x0A ),
|
map( ProtocolConstants.MINECRAFT_1_13, 0x0A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x0B ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x0B ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x0A ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x0A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x0C )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x0C ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x0D )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -39,6 +39,7 @@ public class ProtocolConstants
|
|||||||
public static final int MINECRAFT_1_18 = 757;
|
public static final int MINECRAFT_1_18 = 757;
|
||||||
public static final int MINECRAFT_1_18_2 = 758;
|
public static final int MINECRAFT_1_18_2 = 758;
|
||||||
public static final int MINECRAFT_1_19 = 759;
|
public static final int MINECRAFT_1_19 = 759;
|
||||||
|
public static final int MINECRAFT_1_19_1 = 760;
|
||||||
public static final List<String> SUPPORTED_VERSIONS;
|
public static final List<String> SUPPORTED_VERSIONS;
|
||||||
public static final List<Integer> SUPPORTED_VERSION_IDS;
|
public static final List<Integer> SUPPORTED_VERSION_IDS;
|
||||||
|
|
||||||
@ -90,7 +91,8 @@ public class ProtocolConstants
|
|||||||
ProtocolConstants.MINECRAFT_1_17_1,
|
ProtocolConstants.MINECRAFT_1_17_1,
|
||||||
ProtocolConstants.MINECRAFT_1_18,
|
ProtocolConstants.MINECRAFT_1_18,
|
||||||
ProtocolConstants.MINECRAFT_1_18_2,
|
ProtocolConstants.MINECRAFT_1_18_2,
|
||||||
ProtocolConstants.MINECRAFT_1_19
|
ProtocolConstants.MINECRAFT_1_19,
|
||||||
|
ProtocolConstants.MINECRAFT_1_19_1
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( SNAPSHOT_SUPPORT )
|
if ( SNAPSHOT_SUPPORT )
|
||||||
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import net.md_5.bungee.protocol.AbstractPacketHandler;
|
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.DefinedPacket;
|
||||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||||
|
|
||||||
@ -21,6 +22,7 @@ public class ClientChat extends DefinedPacket
|
|||||||
private long salt;
|
private long salt;
|
||||||
private byte[] signature;
|
private byte[] signature;
|
||||||
private boolean signedPreview;
|
private boolean signedPreview;
|
||||||
|
private ChatChain chain;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
@ -30,6 +32,11 @@ public class ClientChat extends DefinedPacket
|
|||||||
salt = buf.readLong();
|
salt = buf.readLong();
|
||||||
signature = readArray( buf );
|
signature = readArray( buf );
|
||||||
signedPreview = buf.readBoolean();
|
signedPreview = buf.readBoolean();
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
|
{
|
||||||
|
chain = new ChatChain();
|
||||||
|
chain.read( buf, direction, protocolVersion );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -40,6 +47,10 @@ public class ClientChat extends DefinedPacket
|
|||||||
buf.writeLong( salt );
|
buf.writeLong( salt );
|
||||||
writeArray( signature, buf );
|
writeArray( signature, buf );
|
||||||
buf.writeBoolean( signedPreview );
|
buf.writeBoolean( signedPreview );
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
|
{
|
||||||
|
chain.write( buf );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,6 +9,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import net.md_5.bungee.protocol.AbstractPacketHandler;
|
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.DefinedPacket;
|
||||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ public class ClientCommand extends DefinedPacket
|
|||||||
private long salt;
|
private long salt;
|
||||||
private Map<String, byte[]> signatures;
|
private Map<String, byte[]> signatures;
|
||||||
private boolean signedPreview;
|
private boolean signedPreview;
|
||||||
|
private ChatChain chain;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
@ -41,6 +43,11 @@ public class ClientCommand extends DefinedPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
signedPreview = buf.readBoolean();
|
signedPreview = buf.readBoolean();
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
|
{
|
||||||
|
chain = new ChatChain();
|
||||||
|
chain.read( buf, direction, protocolVersion );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -58,6 +65,10 @@ public class ClientCommand extends DefinedPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
buf.writeBoolean( signedPreview );
|
buf.writeBoolean( signedPreview );
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
|
{
|
||||||
|
chain.write( buf );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.md_5.bungee.protocol.packet;
|
package net.md_5.bungee.protocol.packet;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@ -19,6 +20,7 @@ public class LoginRequest extends DefinedPacket
|
|||||||
|
|
||||||
private String data;
|
private String data;
|
||||||
private PlayerPublicKey publicKey;
|
private PlayerPublicKey publicKey;
|
||||||
|
private UUID uuid;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
@ -28,6 +30,13 @@ public class LoginRequest extends DefinedPacket
|
|||||||
{
|
{
|
||||||
publicKey = readPublicKey( buf );
|
publicKey = readPublicKey( buf );
|
||||||
}
|
}
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
|
{
|
||||||
|
if ( buf.readBoolean() )
|
||||||
|
{
|
||||||
|
uuid = readUUID( buf );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -38,6 +47,17 @@ public class LoginRequest extends DefinedPacket
|
|||||||
{
|
{
|
||||||
writePublicKey( publicKey, buf );
|
writePublicKey( publicKey, buf );
|
||||||
}
|
}
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
|
{
|
||||||
|
if ( uuid != null )
|
||||||
|
{
|
||||||
|
buf.writeBoolean( true );
|
||||||
|
writeUUID( uuid, buf );
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
buf.writeBoolean( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,84 +0,0 @@
|
|||||||
package net.md_5.bungee.protocol.packet;
|
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import java.util.UUID;
|
|
||||||
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.DefinedPacket;
|
|
||||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class PlayerChat extends DefinedPacket
|
|
||||||
{
|
|
||||||
|
|
||||||
private static final UUID EMPTY_UUID = new UUID( 0L, 0L );
|
|
||||||
private String signedContent;
|
|
||||||
private String unsignedContent; // nullable
|
|
||||||
private UUID sender;
|
|
||||||
private int typeId;
|
|
||||||
private String displayName;
|
|
||||||
private String teamName; // nullable
|
|
||||||
private long timestamp;
|
|
||||||
private long salt;
|
|
||||||
private byte[] signature;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
|
||||||
{
|
|
||||||
signedContent = readString( buf, 262144 );
|
|
||||||
if ( buf.readBoolean() )
|
|
||||||
{
|
|
||||||
unsignedContent = readString( buf, 262144 );
|
|
||||||
}
|
|
||||||
typeId = readVarInt( buf );
|
|
||||||
sender = readUUID( buf );
|
|
||||||
displayName = readString( buf, 262144 );
|
|
||||||
if ( buf.readBoolean() )
|
|
||||||
{
|
|
||||||
teamName = readString( buf, 262144 );
|
|
||||||
}
|
|
||||||
timestamp = buf.readLong();
|
|
||||||
salt = buf.readLong();
|
|
||||||
signature = readArray( buf );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
|
||||||
{
|
|
||||||
writeString( signedContent, buf );
|
|
||||||
if ( unsignedContent != null )
|
|
||||||
{
|
|
||||||
buf.writeBoolean( true );
|
|
||||||
writeString( unsignedContent, buf );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
buf.writeBoolean( false );
|
|
||||||
}
|
|
||||||
writeVarInt( typeId, buf );
|
|
||||||
writeUUID( sender, buf );
|
|
||||||
writeString( displayName, buf );
|
|
||||||
if ( teamName != null )
|
|
||||||
{
|
|
||||||
buf.writeBoolean( true );
|
|
||||||
writeString( teamName, buf );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
buf.writeBoolean( false );
|
|
||||||
}
|
|
||||||
buf.writeLong( timestamp );
|
|
||||||
buf.writeLong( salt );
|
|
||||||
writeArray( signature, buf );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handle(AbstractPacketHandler handler) throws Exception
|
|
||||||
{
|
|
||||||
handler.handle( this );
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import net.md_5.bungee.protocol.AbstractPacketHandler;
|
import net.md_5.bungee.protocol.AbstractPacketHandler;
|
||||||
import net.md_5.bungee.protocol.DefinedPacket;
|
import net.md_5.bungee.protocol.DefinedPacket;
|
||||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||||
@ -23,15 +24,21 @@ public class SystemChat extends DefinedPacket
|
|||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
{
|
{
|
||||||
message = readString( buf, 262144 );
|
message = readString( buf, 262144 );
|
||||||
position = readVarInt( buf );
|
position = ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 ) ? ( ( buf.readBoolean() ) ? ChatMessageType.ACTION_BAR.ordinal() : 0 ) : readVarInt( buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
{
|
{
|
||||||
writeString( message, buf );
|
writeString( message, buf );
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
|
{
|
||||||
|
buf.writeBoolean( position == ChatMessageType.ACTION_BAR.ordinal() );
|
||||||
|
} else
|
||||||
|
{
|
||||||
writeVarInt( position, buf );
|
writeVarInt( position, buf );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(AbstractPacketHandler handler) throws Exception
|
public void handle(AbstractPacketHandler handler) throws Exception
|
||||||
|
@ -3,6 +3,8 @@ package net.md_5.bungee;
|
|||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
import com.google.common.primitives.Longs;
|
import com.google.common.primitives.Longs;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.ByteOrder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
import java.security.Key;
|
import java.security.Key;
|
||||||
@ -17,6 +19,7 @@ import java.security.spec.X509EncodedKeySpec;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.UUID;
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import javax.crypto.SecretKey;
|
import javax.crypto.SecretKey;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
@ -73,12 +76,23 @@ public class EncryptionUtil
|
|||||||
return new EncryptionRequest( hash, pubKey, verify );
|
return new EncryptionRequest( hash, pubKey, verify );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean check(PlayerPublicKey publicKey) throws GeneralSecurityException
|
public static boolean check(PlayerPublicKey publicKey, UUID uuid) throws GeneralSecurityException
|
||||||
{
|
{
|
||||||
Signature signature = Signature.getInstance( "SHA1withRSA" );
|
Signature signature = Signature.getInstance( "SHA1withRSA" );
|
||||||
signature.initVerify( MOJANG_KEY );
|
signature.initVerify( MOJANG_KEY );
|
||||||
|
|
||||||
signature.update( ( publicKey.getExpiry() + "-----BEGIN RSA PUBLIC KEY-----\n" + MIME_ENCODER.encodeToString( getPubkey( publicKey.getKey() ).getEncoded() ) + "\n-----END RSA PUBLIC KEY-----\n" ).getBytes( StandardCharsets.US_ASCII ) );
|
byte[] check;
|
||||||
|
if ( uuid != null )
|
||||||
|
{
|
||||||
|
byte[] encoded = getPubkey( publicKey.getKey() ).getEncoded();
|
||||||
|
check = new byte[ 24 + encoded.length ];
|
||||||
|
|
||||||
|
ByteBuffer.wrap( check ).order( ByteOrder.BIG_ENDIAN ).putLong( uuid.getMostSignificantBits() ).putLong( uuid.getLeastSignificantBits() ).putLong( publicKey.getExpiry() ).put( encoded );
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
check = ( publicKey.getExpiry() + "-----BEGIN RSA PUBLIC KEY-----\n" + MIME_ENCODER.encodeToString( getPubkey( publicKey.getKey() ).getEncoded() ) + "\n-----END RSA PUBLIC KEY-----\n" ).getBytes( StandardCharsets.US_ASCII );
|
||||||
|
}
|
||||||
|
signature.update( check );
|
||||||
|
|
||||||
return signature.verify( publicKey.getSignature() );
|
return signature.verify( publicKey.getSignature() );
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ public class ServerConnector extends PacketHandler
|
|||||||
channel.write( copiedHandshake );
|
channel.write( copiedHandshake );
|
||||||
|
|
||||||
channel.setProtocol( Protocol.LOGIN );
|
channel.setProtocol( Protocol.LOGIN );
|
||||||
channel.write( new LoginRequest( user.getName(), null ) );
|
channel.write( new LoginRequest( user.getName(), null, user.getUniqueId() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,6 +8,7 @@ import java.net.InetSocketAddress;
|
|||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.security.GeneralSecurityException;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -396,12 +397,15 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !EncryptionUtil.check( publicKey ) )
|
if ( getVersion() < ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
|
{
|
||||||
|
if ( !EncryptionUtil.check( publicKey, null ) )
|
||||||
{
|
{
|
||||||
disconnect( bungee.getTranslation( "secure_profile_invalid" ) );
|
disconnect( bungee.getTranslation( "secure_profile_invalid" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.loginRequest = loginRequest;
|
this.loginRequest = loginRequest;
|
||||||
|
|
||||||
@ -509,6 +513,32 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
|
|
||||||
private void finish()
|
private void finish()
|
||||||
{
|
{
|
||||||
|
offlineId = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + getName() ).getBytes( Charsets.UTF_8 ) );
|
||||||
|
if ( uniqueId == null )
|
||||||
|
{
|
||||||
|
uniqueId = offlineId;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( BungeeCord.getInstance().config.isEnforceSecureProfile() )
|
||||||
|
{
|
||||||
|
if ( getVersion() >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
|
{
|
||||||
|
boolean secure = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
secure = EncryptionUtil.check( loginRequest.getPublicKey(), uniqueId );
|
||||||
|
} catch ( GeneralSecurityException ex )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !secure )
|
||||||
|
{
|
||||||
|
disconnect( bungee.getTranslation( "secure_profile_invalid" ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( isOnlineMode() )
|
if ( isOnlineMode() )
|
||||||
{
|
{
|
||||||
// Check for multiple connections
|
// Check for multiple connections
|
||||||
@ -539,12 +569,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
offlineId = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + getName() ).getBytes( Charsets.UTF_8 ) );
|
|
||||||
if ( uniqueId == null )
|
|
||||||
{
|
|
||||||
uniqueId = offlineId;
|
|
||||||
}
|
|
||||||
|
|
||||||
Callback<LoginEvent> complete = new Callback<LoginEvent>()
|
Callback<LoginEvent> complete = new Callback<LoginEvent>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,6 +76,8 @@ public abstract class EntityMap
|
|||||||
return EntityMap_1_16_2.INSTANCE_1_18;
|
return EntityMap_1_16_2.INSTANCE_1_18;
|
||||||
case ProtocolConstants.MINECRAFT_1_19:
|
case ProtocolConstants.MINECRAFT_1_19:
|
||||||
return EntityMap_1_16_2.INSTANCE_1_19;
|
return EntityMap_1_16_2.INSTANCE_1_19;
|
||||||
|
case ProtocolConstants.MINECRAFT_1_19_1:
|
||||||
|
return EntityMap_1_16_2.INSTANCE_1_19_1;
|
||||||
}
|
}
|
||||||
throw new RuntimeException( "Version " + version + " has no entity map" );
|
throw new RuntimeException( "Version " + version + " has no entity map" );
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ class EntityMap_1_16_2 extends EntityMap
|
|||||||
static final EntityMap_1_16_2 INSTANCE_1_17 = new EntityMap_1_16_2( 0x04, 0x2D );
|
static final EntityMap_1_16_2 INSTANCE_1_17 = new EntityMap_1_16_2( 0x04, 0x2D );
|
||||||
static final EntityMap_1_16_2 INSTANCE_1_18 = new EntityMap_1_16_2( 0x04, 0x2D );
|
static final EntityMap_1_16_2 INSTANCE_1_18 = new EntityMap_1_16_2( 0x04, 0x2D );
|
||||||
static final EntityMap_1_16_2 INSTANCE_1_19 = new EntityMap_1_16_2( 0x02, 0x2F );
|
static final EntityMap_1_16_2 INSTANCE_1_19 = new EntityMap_1_16_2( 0x02, 0x2F );
|
||||||
|
static final EntityMap_1_16_2 INSTANCE_1_19_1 = new EntityMap_1_16_2( 0x02, 0x30 );
|
||||||
//
|
//
|
||||||
private final int spawnPlayerId;
|
private final int spawnPlayerId;
|
||||||
private final int spectateId;
|
private final int spectateId;
|
||||||
|
Loading…
Reference in New Issue
Block a user