mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-02-17 03:02:35 +01:00
WiredEffectResetTimers now saves as json
This commit is contained in:
parent
b1e9276940
commit
9b6ae05ac3
@ -85,17 +85,25 @@ public class WiredEffectResetTimers extends InteractionWiredEffect {
|
||||
|
||||
@Override
|
||||
public String getWiredData() {
|
||||
return this.delay + "";
|
||||
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
||||
this.delay
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||
String data = set.getString("wired_data");
|
||||
|
||||
try {
|
||||
if (!data.equals(""))
|
||||
this.delay = Integer.valueOf(data);
|
||||
} catch (Exception e) {
|
||||
if (data.startsWith("{")) {
|
||||
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
||||
this.delay = data.delay;
|
||||
} else {
|
||||
try {
|
||||
if (!data.equals("")) {
|
||||
this.delay = Integer.valueOf(data);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
this.setDelay(this.delay);
|
||||
@ -111,4 +119,12 @@ public class WiredEffectResetTimers extends InteractionWiredEffect {
|
||||
public WiredEffectType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
int delay;
|
||||
|
||||
public JsonData(int delay) {
|
||||
this.delay = delay;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user