feat!: support creating a wrapped GameProfile with textureSignature

This commit is contained in:
Christian Koop 2024-09-22 16:07:02 +02:00
parent 2f2979c6aa
commit f3d230cc90
No known key found for this signature in database
GPG Key ID: 6A4A09E8ED946113
28 changed files with 57 additions and 57 deletions

View File

@ -13,16 +13,16 @@ public interface NMSPlayer {
GameProfile getProfile(Player p);
GameProfile createProfile(UUID id, String name, @Nullable String textureValue);
GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature);
default GameProfile createProfileByUrl(String url) {
UUID id = UUID.nameUUIDFromBytes(("SongodaCore:" + url).getBytes(StandardCharsets.UTF_8));
String rawTextureValue = "{\"textures\":{\"SKIN\":{\"url\":\"" + url + "\"}}}";
return createProfile(id, "by_SongodaCore", Base64.getEncoder().encodeToString(rawTextureValue.getBytes()));
return createProfile(id, "by_SongodaCore", Base64.getEncoder().encodeToString(rawTextureValue.getBytes()), null);
}
default GameProfile createProfileByTextureValue(String textureValue) {
UUID id = UUID.nameUUIDFromBytes(("SongodaCore:" + textureValue).getBytes(StandardCharsets.UTF_8));
return createProfile(id, "by_SongodaCore", textureValue);
return createProfile(id, "by_SongodaCore", textureValue, null);
}
}

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -24,10 +24,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -24,10 +24,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);

View File

@ -23,10 +23,10 @@ public class NMSPlayerImpl implements NMSPlayer {
}
@Override
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue) {
public GameProfile createProfile(UUID id, String name, @Nullable String textureValue, @Nullable String textureSignature) {
com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(id, name);
if (textureValue != null) {
profile.getProperties().put("textures", new Property("textures", textureValue));
profile.getProperties().put("textures", new Property("textures", textureValue, textureSignature));
}
return wrapProfile(profile);