mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Manually solve some merge issues
This commit is contained in:
parent
0e7dca551e
commit
dc8fb46428
2 changed files with 89 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue