#3823: Add client brand API

This commit is contained in:
Outfluencer
2025-04-21 08:28:16 +02:00
committed by GitHub
parent 1279cca971
commit 89069a362d
3 changed files with 17 additions and 0 deletions

View File

@@ -778,6 +778,11 @@ public final class UserConnection implements ProxiedPlayer
return this.getPendingConnection().getExtraDataInHandshake();
}
public String getClientBrand()
{
return getPendingConnection().getClientBrand();
}
public void setCompressionThreshold(int compressionThreshold)
{
if ( !ch.isClosing() && this.compressionThreshold == -1 && compressionThreshold >= 0 )

View File

@@ -2,6 +2,7 @@ package net.md_5.bungee.connection;
import com.google.common.base.Preconditions;
import com.google.gson.Gson;
import io.netty.buffer.Unpooled;
import java.math.BigInteger;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
@@ -97,6 +98,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@Getter
private PluginMessage brandMessage;
@Getter
private String clientBrand;
@Getter
private final Set<String> registeredChannels = new HashSet<>();
private State thisState = State.HANDSHAKE;
private int loginPayloadId;
@@ -849,6 +852,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
} else if ( input.getTag().equals( "MC|Brand" ) || input.getTag().equals( "minecraft:brand" ) )
{
brandMessage = input;
clientBrand = DefinedPacket.readString( Unpooled.wrappedBuffer( input.getData() ) );
}
}