From 4291b3553b3a6cdc5d8f4ac2cb6a2ca2508d256f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linnea=20Gr=C3=A4f?= Date: Thu, 11 Jan 2024 22:12:57 +0100 Subject: [PATCH] Add legacy chromoa colour to default gson mapper --- .../java/io/github/moulberry/moulconfig/managed/GsonMapper.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/src/main/java/io/github/moulberry/moulconfig/managed/GsonMapper.kt b/common/src/main/java/io/github/moulberry/moulconfig/managed/GsonMapper.kt index 39c701b20..72e98ba44 100644 --- a/common/src/main/java/io/github/moulberry/moulconfig/managed/GsonMapper.kt +++ b/common/src/main/java/io/github/moulberry/moulconfig/managed/GsonMapper.kt @@ -1,11 +1,14 @@ package io.github.moulberry.moulconfig.managed import com.google.gson.GsonBuilder +import io.github.moulberry.moulconfig.ChromaColour +import io.github.moulberry.moulconfig.LegacyStringChromaColourTypeAdapter import io.github.moulberry.moulconfig.observer.PropertyTypeAdapterFactory class GsonMapper(val clazz: Class) : DataMapper { val gsonBuilder = GsonBuilder() .registerTypeAdapterFactory(PropertyTypeAdapterFactory()) + .registerTypeAdapter(ChromaColour::class.java, LegacyStringChromaColourTypeAdapter(true)) private val gson by lazy { gsonBuilder.create() } override fun serialize(value: T): String { return gson.toJson(value)