#3823: Add client brand API
This commit is contained in:
parent
1279cca971
commit
89069a362d
@ -382,4 +382,12 @@ public interface ProxiedPlayer extends Connection, CommandSender
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
void transfer(String host, int port);
|
||||
|
||||
/**
|
||||
* Gets the client brand of this player.
|
||||
* If the player has not sent a brand packet yet, it will return null.
|
||||
*
|
||||
* @return the brand of the client, or null if not received yet
|
||||
*/
|
||||
String getClientBrand();
|
||||
}
|
||||
|
@ -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 )
|
||||
|
@ -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() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user