File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
api/src/main/java/net/md_5/bungee/api/connection
proxy/src/main/java/net/md_5/bungee Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -382,4 +382,12 @@ public enum MainHand
382382 */
383383 @ ApiStatus .Experimental
384384 void transfer (String host , int port );
385+
386+ /**
387+ * Gets the client brand of this player.
388+ * If the player has not sent a brand packet yet, it will return null.
389+ *
390+ * @return the brand of the client, or null if not received yet
391+ */
392+ String getClientBrand ();
385393}
Original file line number Diff line number Diff line change @@ -778,6 +778,11 @@ public String getExtraDataInHandshake()
778778 return this .getPendingConnection ().getExtraDataInHandshake ();
779779 }
780780
781+ public String getClientBrand ()
782+ {
783+ return getPendingConnection ().getClientBrand ();
784+ }
785+
781786 public void setCompressionThreshold (int compressionThreshold )
782787 {
783788 if ( !ch .isClosing () && this .compressionThreshold == -1 && compressionThreshold >= 0 )
Original file line number Diff line number Diff line change 22
33import com .google .common .base .Preconditions ;
44import com .google .gson .Gson ;
5+ import io .netty .buffer .Unpooled ;
56import java .math .BigInteger ;
67import java .net .InetSocketAddress ;
78import java .net .SocketAddress ;
@@ -97,6 +98,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
9798 @ Getter
9899 private PluginMessage brandMessage ;
99100 @ Getter
101+ private String clientBrand ;
102+ @ Getter
100103 private final Set <String > registeredChannels = new HashSet <>();
101104 private State thisState = State .HANDSHAKE ;
102105 private int loginPayloadId ;
@@ -849,6 +852,7 @@ public void relayMessage(PluginMessage input) throws Exception
849852 } else if ( input .getTag ().equals ( "MC|Brand" ) || input .getTag ().equals ( "minecraft:brand" ) )
850853 {
851854 brandMessage = input ;
855+ clientBrand = DefinedPacket .readString ( Unpooled .wrappedBuffer ( input .getData () ) );
852856 }
853857 }
854858
You can’t perform that action at this time.
0 commit comments