mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-19 07:56:26 +01:00
WiredTriggerScoreAchieved now saves as json
This commit is contained in:
parent
eaeafd21ad
commit
09e2916310
@ -37,14 +37,23 @@ public class WiredTriggerScoreAchieved extends InteractionWiredTrigger {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getWiredData() {
|
public String getWiredData() {
|
||||||
return this.score + "";
|
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
||||||
|
this.score
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||||
try {
|
String wiredData = set.getString("wired_data");
|
||||||
this.score = Integer.valueOf(set.getString("wired_data"));
|
|
||||||
} catch (Exception e) {
|
if (wiredData.startsWith("{")) {
|
||||||
|
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
||||||
|
this.score = data.score;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
this.score = Integer.valueOf(wiredData);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,4 +94,12 @@ public class WiredTriggerScoreAchieved extends InteractionWiredTrigger {
|
|||||||
public boolean isTriggeredByRoomUnit() {
|
public boolean isTriggeredByRoomUnit() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class JsonData {
|
||||||
|
int score;
|
||||||
|
|
||||||
|
public JsonData(int score) {
|
||||||
|
this.score = score;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user