diff --git a/bootstrap/spigot/build.gradle.kts b/bootstrap/spigot/build.gradle.kts index 1f637d8f8..e4161164e 100644 --- a/bootstrap/spigot/build.gradle.kts +++ b/bootstrap/spigot/build.gradle.kts @@ -26,7 +26,10 @@ dependencies { compileOnlyApi(libs.viaversion) - implementation(libs.gson.record.factory) // For 1.16.5/1.17.1 + // For 1.16.5/1.17.1 + implementation(libs.gson.record.factory) { + isTransitive = false + } } platformRelocate("it.unimi.dsi.fastutil") diff --git a/core/src/main/java/org/geysermc/geyser/configuration/GeyserCustomSkullConfiguration.java b/core/src/main/java/org/geysermc/geyser/configuration/GeyserCustomSkullConfiguration.java index 1af3578a3..46bbb2db1 100644 --- a/core/src/main/java/org/geysermc/geyser/configuration/GeyserCustomSkullConfiguration.java +++ b/core/src/main/java/org/geysermc/geyser/configuration/GeyserCustomSkullConfiguration.java @@ -25,26 +25,21 @@ package org.geysermc.geyser.configuration; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import org.spongepowered.configurate.objectmapping.ConfigSerializable; import java.util.Collections; import java.util.List; import java.util.Objects; -@JsonIgnoreProperties(ignoreUnknown = true) +@ConfigSerializable @SuppressWarnings("FieldMayBeFinal") // Jackson requires that the fields are not final public class GeyserCustomSkullConfiguration { - @JsonProperty("player-usernames") private List playerUsernames; - @JsonProperty("player-uuids") private List playerUUIDs; - @JsonProperty("player-profiles") private List playerProfiles; - @JsonProperty("skin-hashes") private List skinHashes; public List getPlayerUsernames() { diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/CustomSkullRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/CustomSkullRegistryPopulator.java index ec7243396..840834690 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/CustomSkullRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/CustomSkullRegistryPopulator.java @@ -64,7 +64,7 @@ public class CustomSkullRegistryPopulator { GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap(); Path skullConfigPath = bootstrap.getConfigFolder().resolve("custom-skulls.yml"); File skullConfigFile = FileUtils.fileOrCopiedFromResource(skullConfigPath.toFile(), "custom-skulls.yml", Function.identity(), bootstrap); - skullConfig = FileUtils.loadConfig(skullConfigFile, GeyserCustomSkullConfiguration.class); + skullConfig = FileUtils.loadConfigNew(skullConfigFile, GeyserCustomSkullConfiguration.class); } catch (IOException e) { GeyserImpl.getInstance().getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.config.failed"), e); return; diff --git a/core/src/main/java/org/geysermc/geyser/util/FileUtils.java b/core/src/main/java/org/geysermc/geyser/util/FileUtils.java index 9933a713c..0bf389d3f 100644 --- a/core/src/main/java/org/geysermc/geyser/util/FileUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/FileUtils.java @@ -32,6 +32,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import org.geysermc.geyser.GeyserBootstrap; import org.geysermc.geyser.GeyserImpl; +import org.spongepowered.configurate.ConfigurationNode; +import org.spongepowered.configurate.yaml.YamlConfigurationLoader; import java.io.BufferedReader; import java.io.File; @@ -68,6 +70,14 @@ public class FileUtils { return objectMapper.readValue(src, valueType); } + public static T loadConfigNew(File src, Class valueType) throws IOException { + YamlConfigurationLoader loader = YamlConfigurationLoader.builder() + .file(src) + .build(); + ConfigurationNode node = loader.load(); + return node.get(valueType); + } + public static T loadJson(InputStream src, Class valueType) { // Read specifically with UTF-8 to allow any non-UTF-encoded JSON to read return GeyserImpl.GSON.fromJson(new InputStreamReader(src, StandardCharsets.UTF_8), valueType);