1
0
mirror of https://github.com/GeyserMC/Geyser.git synced 2025-12-26 10:19:12 +00:00

Manually solve some merge issues

This commit is contained in:
Tim203
2020-10-30 01:14:34 +01:00
parent 0e7dca551e
commit dc8fb46428
2 changed files with 89 additions and 1 deletions

View File

@@ -26,12 +26,14 @@
package org.geysermc.common.form;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.SerializedName;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.geysermc.common.form.response.FormResponse;
import org.geysermc.common.form.util.FormAdaptor;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
@@ -39,7 +41,11 @@ import java.util.function.Consumer;
@Getter
public abstract class Form {
protected static final Gson GSON = new Gson();
protected static final Gson GSON =
new GsonBuilder()
.registerTypeAdapter(ModalForm.class, new FormAdaptor())
.create();
private final Type type;
@Getter(AccessLevel.NONE)
@@ -51,6 +57,10 @@ public abstract class Form {
this.type = type;
}
public static <T extends Form> T fromJson(String json, Class<T> formClass) {
return GSON.fromJson(json, formClass);
}
public String getJsonData() {
if (hardcodedJsonData != null) {
return hardcodedJsonData;