Skip to content

Commit abf1a3a

Browse files
authored
Merge pull request #35 from SpigotMC/master
[pull] master from SpigotMC:master
2 parents 2b4b698 + 89069a3 commit abf1a3a

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

proxy/src/main/java/net/md_5/bungee/UserConnection.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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 )

proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.google.common.base.Preconditions;
44
import com.google.gson.Gson;
5+
import io.netty.buffer.Unpooled;
56
import java.math.BigInteger;
67
import java.net.InetSocketAddress;
78
import 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

0 commit comments

Comments
 (0)