Skip to content

Commit

Permalink
Include port in server address
Browse files Browse the repository at this point in the history
  • Loading branch information
Kas-tle authored May 10, 2024
1 parent 46d566e commit 33583f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private void initializeOnlineProxySession() {
downstream.setPlayer(proxySession);
this.session.setPlayer(proxySession);

String skinData = ForgeryUtils.forgeOnlineSkinData(account, this.skinData, this.proxy.getTargetAddress().getHostString());
String skinData = ForgeryUtils.forgeOnlineSkinData(account, this.skinData, this.proxy.getTargetAddress());

try {
player.getLogger().saveJson("skinData", this.skinData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.jose4j.jwx.HeaderParameterNames;
import org.jose4j.lang.JoseException;

import java.net.InetSocketAddress;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.interfaces.ECPublicKey;
Expand Down Expand Up @@ -104,15 +105,15 @@ public static String forgeOfflineSkinData(KeyPair pair, JSONObject skinData) {
}

@SuppressWarnings("unchecked")
public static String forgeOnlineSkinData(Account account, JSONObject skinData, String serverAddress) {
public static String forgeOnlineSkinData(Account account, JSONObject skinData, InetSocketAddress serverAddress) {
String publicKeyBase64 = Base64.getEncoder().encodeToString(account.bedrockSession().getMcChain().getPublicKey().getEncoded());

HashMap<String,Object> overrideData = new HashMap<String,Object>();
overrideData.put("PlayFabId", account.bedrockSession().getPlayFabToken().getPlayFabId().toLowerCase(Locale.ROOT));
overrideData.put("DeviceId", UUID.randomUUID().toString());
overrideData.put("DeviceOS", 1); // Android per MinecraftAuth 4.0
overrideData.put("ThirdPartyName", account.bedrockSession().getMcChain().getDisplayName());
overrideData.put("ServerAddress", serverAddress);
overrideData.put("ServerAddress", serverAddress.getHostString() + ":" + String.valueOf(serverAddress.getPort()));

skinData.putAll(overrideData);

Expand Down

0 comments on commit 33583f7

Please sign in to comment.