mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-27 00:40:52 +01:00
WiredTriggerRepeater now saves as json
This commit is contained in:
parent
4fcf750763
commit
9b62b43907
@ -41,13 +41,22 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICy
|
||||
|
||||
@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 < 500) {
|
||||
@ -136,4 +145,12 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICy
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
int repeatTime;
|
||||
|
||||
public JsonData(int repeatTime) {
|
||||
this.repeatTime = repeatTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user