[FEATURE] GSON serialize Record

This commit is contained in:
Gravita 2021-11-09 14:12:31 +07:00
parent 2d0957f834
commit f8569f9165
3 changed files with 9 additions and 0 deletions

View file

@ -10,6 +10,9 @@
maven {
url "https://jcenter.bintray.com/"
}
maven {
url "https://jitpack.io/"
}
}
sourceCompatibility = '17'
@ -72,6 +75,7 @@ task cleanjar(type: Jar, dependsOn: jar) {
dependencies {
pack project(':LauncherAPI')
bundle group: 'me.tongfei', name: 'progressbar', version: '0.9.2'
bundle group: 'com.github.Marcono1234', name: 'gson-record-type-adapter-factory', version: 'v0.1.0'
bundle group: 'org.fusesource.jansi', name: 'jansi', version: rootProject['verJansi']
bundle group: 'org.jline', name: 'jline', version: rootProject['verJline']
bundle group: 'org.jline', name: 'jline-reader', version: rootProject['verJline']

View file

@ -1,6 +1,7 @@
package pro.gravit.launchserver.manangers;
import com.google.gson.GsonBuilder;
import marcono1234.gson.recordadapter.RecordTypeAdapterFactory;
import pro.gravit.launcher.events.request.GetAvailabilityAuthRequestEvent;
import pro.gravit.launcher.managers.GsonManager;
import pro.gravit.launcher.modules.events.PreGsonPhase;
@ -33,6 +34,7 @@ public LaunchServerGsonManager(LaunchServerModulesManager modulesManager) {
@Override
public void registerAdapters(GsonBuilder builder) {
super.registerAdapters(builder);
builder.registerTypeAdapterFactory(RecordTypeAdapterFactory.DEFAULT);
builder.registerTypeAdapter(TextureProvider.class, new UniversalJsonAdapter<>(TextureProvider.providers));
builder.registerTypeAdapter(AuthCoreProvider.class, new UniversalJsonAdapter<>(AuthCoreProvider.providers));
builder.registerTypeAdapter(PasswordVerifier.class, new UniversalJsonAdapter<>(PasswordVerifier.providers));

View file

@ -27,6 +27,9 @@
maven {
url "https://jcenter.bintray.com/"
}
maven {
url "https://jitpack.io/"
}
}
jar {