Archiviert
1
0
Dieser Commit ist enthalten in:
Finn 2023-04-20 12:16:17 +02:00
Ursprung ba106edd58
Commit 2a91330453

Datei anzeigen

@ -37,28 +37,4 @@ public class ModSettingsAdapter implements JsonSerializer<ModSettings> {
object.add("properties", properties);
return object;
}
private ModSettings.ModSetting deserializeModSetting(JsonObject object) {
JsonObject propertiesObject = object.get("properties").getAsJsonObject();
Map<String, Object> properties = new HashMap<>();
for (Map.Entry<String, JsonElement> entry : propertiesObject.entrySet()) {
if (!entry.getValue().isJsonPrimitive()) {
continue;
}
JsonPrimitive primitive = entry.getValue().getAsJsonPrimitive();
Object toSet;
if (primitive.isString()) {
toSet = primitive.getAsString();
} else if (primitive.isNumber()) {
toSet = primitive.getAsNumber();
} else if (primitive.isBoolean()) {
toSet = primitive.getAsBoolean();
} else {
continue;
}
properties.put(entry.getKey(), toSet);
}
return new ModSettings.ModSetting(object.get("enabled").getAsBoolean(), properties);
}
}