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