From ffcff96bea6e43ec34725c648eb5e9c76cad40ea Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Sat, 10 Oct 2020 18:08:21 -0400 Subject: [PATCH] Set default values for classes as well (#1387) Geyser can now start even if the config file is empty. Tested on Spigot and doesn't affect custom values. --- .../configuration/GeyserJacksonConfiguration.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java b/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java index 99a3a7a5..45676fbd 100644 --- a/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java +++ b/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java @@ -34,6 +34,7 @@ import org.geysermc.connector.common.serializer.AsteriskSerializer; import java.nio.file.Path; import java.util.Map; +import java.util.UUID; @Getter @JsonIgnoreProperties(ignoreUnknown = true) @@ -45,8 +46,8 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration @Setter private boolean autoconfiguredRemote = false; - private BedrockConfiguration bedrock; - private RemoteConfiguration remote; + private BedrockConfiguration bedrock = new BedrockConfiguration(); + private RemoteConfiguration remote = new RemoteConfiguration(); @JsonProperty("floodgate-key-file") private String floodgateKeyFile = "public-key.pem"; @@ -106,7 +107,7 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration @JsonProperty("force-resource-packs") private boolean forceResourcePacks = true; - private MetricsInfo metrics; + private MetricsInfo metrics = new MetricsInfo(); @Getter public static class BedrockConfiguration implements IBedrockConfiguration { @@ -154,7 +155,7 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration private boolean enabled = true; @JsonProperty("uuid") - private String uniqueId = "generateuuid"; + private String uniqueId = UUID.randomUUID().toString(); } @JsonProperty("scoreboard-packet-threshold")