mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-18 23:46:28 +01:00
WiredTriggerAtSetTime now saves as json
This commit is contained in:
parent
a849328412
commit
7c8789a124
@ -39,13 +39,22 @@ public class WiredTriggerAtSetTime extends InteractionWiredTrigger implements Wi
|
||||
|
||||
@Override
|
||||
public String getWiredData() {
|
||||
return this.executeTime + "";
|
||||
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
||||
this.executeTime
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||
if (set.getString("wired_data").length() >= 1) {
|
||||
this.executeTime = (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.executeTime = data.executeTime;
|
||||
} else {
|
||||
if (wiredData.length() >= 1) {
|
||||
this.executeTime = (Integer.valueOf(wiredData));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.executeTime < 500) {
|
||||
@ -115,4 +124,12 @@ public class WiredTriggerAtSetTime extends InteractionWiredTrigger implements Wi
|
||||
|
||||
Emulator.getThreading().run(new WiredExecuteTask(this, Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId())), this.executeTime);
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
int executeTime;
|
||||
|
||||
public JsonData(int executeTime) {
|
||||
this.executeTime = executeTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user