mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-01 23:56:40 +00:00
- Fix NH bug & Gson not liking LocalDateTime
This commit is contained in:
@ -7,6 +7,9 @@ import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
import dev.plex.util.adapter.LocalDateTimeAdapter;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -41,11 +44,11 @@ public class Punishment
|
||||
|
||||
public String toJSON()
|
||||
{
|
||||
return new Gson().toJson(this);
|
||||
return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeAdapter()).create().toJson(this);
|
||||
}
|
||||
|
||||
public static Punishment fromJson(String json)
|
||||
{
|
||||
return new Gson().fromJson(json, Punishment.class);
|
||||
return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeAdapter()).create().fromJson(json, Punishment.class);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user