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
382
382
*/
383
383
@ ApiStatus .Experimental
384
384
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 ();
385
393
}
Original file line number Diff line number Diff line change @@ -778,6 +778,11 @@ public String getExtraDataInHandshake()
778
778
return this .getPendingConnection ().getExtraDataInHandshake ();
779
779
}
780
780
781
+ public String getClientBrand ()
782
+ {
783
+ return getPendingConnection ().getClientBrand ();
784
+ }
785
+
781
786
public void setCompressionThreshold (int compressionThreshold )
782
787
{
783
788
if ( !ch .isClosing () && this .compressionThreshold == -1 && compressionThreshold >= 0 )
Original file line number Diff line number Diff line change 2
2
3
3
import com .google .common .base .Preconditions ;
4
4
import com .google .gson .Gson ;
5
+ import io .netty .buffer .Unpooled ;
5
6
import java .math .BigInteger ;
6
7
import java .net .InetSocketAddress ;
7
8
import java .net .SocketAddress ;
@@ -97,6 +98,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
97
98
@ Getter
98
99
private PluginMessage brandMessage ;
99
100
@ Getter
101
+ private String clientBrand ;
102
+ @ Getter
100
103
private final Set <String > registeredChannels = new HashSet <>();
101
104
private State thisState = State .HANDSHAKE ;
102
105
private int loginPayloadId ;
@@ -849,6 +852,7 @@ public void relayMessage(PluginMessage input) throws Exception
849
852
} else if ( input .getTag ().equals ( "MC|Brand" ) || input .getTag ().equals ( "minecraft:brand" ) )
850
853
{
851
854
brandMessage = input ;
855
+ clientBrand = DefinedPacket .readString ( Unpooled .wrappedBuffer ( input .getData () ) );
852
856
}
853
857
}
854
858
You can’t perform that action at this time.
0 commit comments