mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-30 09:50:51 +01:00
WiredTriggerRepeaterLong now saves as json
This commit is contained in:
parent
9b62b43907
commit
eaeafd21ad
@ -40,13 +40,22 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements
|
||||
|
||||
@Override
|
||||
public String getWiredData() {
|
||||
return this.repeatTime + "";
|
||||
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
||||
this.repeatTime
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||
if (set.getString("wired_data").length() >= 1) {
|
||||
this.repeatTime = (Integer.valueOf(set.getString("wired_data")));
|
||||
String wiredData = set.getString("wired_data");
|
||||
|
||||
if (wiredData.startsWith("{")) {
|
||||
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
||||
this.repeatTime = data.repeatTime;
|
||||
} else {
|
||||
if (wiredData.length() >= 1) {
|
||||
this.repeatTime = (Integer.valueOf(wiredData));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.repeatTime < 5000) {
|
||||
@ -130,4 +139,12 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
int repeatTime;
|
||||
|
||||
public JsonData(int repeatTime) {
|
||||
this.repeatTime = repeatTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user