Fix regression in properties get

This commit is contained in:
Camotoy 2024-06-26 22:35:54 -04:00
parent add02cadd7
commit db9b951352
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
4 changed files with 24 additions and 2 deletions

View file

@ -57,4 +57,14 @@ public class GeyserCustomSkullConfiguration {
public List<String> getPlayerSkinHashes() { public List<String> getPlayerSkinHashes() {
return Objects.requireNonNullElse(skinHashes, Collections.emptyList()); return Objects.requireNonNullElse(skinHashes, Collections.emptyList());
} }
@Override
public String toString() {
return "GeyserCustomSkullConfiguration{" +
"playerUsernames=" + playerUsernames +
", playerUUIDs=" + playerUUIDs +
", playerProfiles=" + playerProfiles +
", skinHashes=" + skinHashes +
'}';
}
} }

View file

@ -65,6 +65,7 @@ public class CustomSkullRegistryPopulator {
Path skullConfigPath = bootstrap.getConfigFolder().resolve("custom-skulls.yml"); Path skullConfigPath = bootstrap.getConfigFolder().resolve("custom-skulls.yml");
File skullConfigFile = FileUtils.fileOrCopiedFromResource(skullConfigPath.toFile(), "custom-skulls.yml", Function.identity(), bootstrap); File skullConfigFile = FileUtils.fileOrCopiedFromResource(skullConfigPath.toFile(), "custom-skulls.yml", Function.identity(), bootstrap);
skullConfig = FileUtils.loadConfigNew(skullConfigFile, GeyserCustomSkullConfiguration.class); skullConfig = FileUtils.loadConfigNew(skullConfigFile, GeyserCustomSkullConfiguration.class);
System.out.println(skullConfig);
} catch (IOException e) { } catch (IOException e) {
GeyserImpl.getInstance().getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.config.failed"), e); GeyserImpl.getInstance().getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.config.failed"), e);
return; return;

View file

@ -27,6 +27,7 @@ package org.geysermc.geyser.skin;
import com.google.common.cache.Cache; import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import it.unimi.dsi.fastutil.bytes.ByteArrays; import it.unimi.dsi.fastutil.bytes.ByteArrays;
@ -487,12 +488,12 @@ public class SkinProvider {
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
try { try {
JsonObject node = WebUtils.getJson("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid); JsonObject node = WebUtils.getJson("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid);
JsonObject properties = node.getAsJsonObject("properties"); JsonArray properties = node.getAsJsonArray("properties");
if (properties == null) { if (properties == null) {
GeyserImpl.getInstance().getLogger().debug("No properties found in Mojang response for " + uuid); GeyserImpl.getInstance().getLogger().debug("No properties found in Mojang response for " + uuid);
return null; return null;
} }
return node.getAsJsonArray("properties").get(0).getAsJsonObject().get("value").getAsString(); return properties.get(0).getAsJsonObject().get("value").getAsString();
} catch (Exception e) { } catch (Exception e) {
GeyserImpl.getInstance().getLogger().debug("Unable to request textures for " + uuid); GeyserImpl.getInstance().getLogger().debug("Unable to request textures for " + uuid);
if (GeyserImpl.getInstance().getConfig().isDebugMode()) { if (GeyserImpl.getInstance().getConfig().isDebugMode()) {
@ -514,6 +515,7 @@ public class SkinProvider {
try { try {
// Offline skin, or no present UUID // Offline skin, or no present UUID
JsonObject node = WebUtils.getJson("https://api.mojang.com/users/profiles/minecraft/" + username); JsonObject node = WebUtils.getJson("https://api.mojang.com/users/profiles/minecraft/" + username);
System.out.println(node);
JsonElement id = node.get("id"); JsonElement id = node.get("id");
if (id == null) { if (id == null) {
GeyserImpl.getInstance().getLogger().debug("No UUID found in Mojang response for " + username); GeyserImpl.getInstance().getLogger().debug("No UUID found in Mojang response for " + username);

View file

@ -296,6 +296,15 @@ public final class AssetUtils {
@SerializedName("url") @SerializedName("url")
private String url; private String url;
@Override
public String toString() {
return "VersionDownload{" +
"sha1='" + sha1 + '\'' +
", size=" + size +
", url='" + url + '\'' +
'}';
}
} }
@Getter @Getter