WiredTriggerBotReachedHabbo now saves as json

This commit is contained in:
Remco 2021-01-04 08:19:56 -05:00
parent fd90c23a3a
commit b781f1d731

View File

@ -62,12 +62,21 @@ public class WiredTriggerBotReachedHabbo extends InteractionWiredTrigger {
@Override @Override
public String getWiredData() { public String getWiredData() {
return this.botName; return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
this.botName
));
} }
@Override @Override
public void loadWiredData(ResultSet set, Room room) throws SQLException { public void loadWiredData(ResultSet set, Room room) throws SQLException {
this.botName = set.getString("wired_data"); String wiredData = set.getString("wired_data");
if (wiredData.startsWith("{")) {
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
this.botName = data.botName;
} else {
this.botName = wiredData;
}
} }
@Override @Override
@ -79,4 +88,12 @@ public class WiredTriggerBotReachedHabbo extends InteractionWiredTrigger {
public boolean isTriggeredByRoomUnit() { public boolean isTriggeredByRoomUnit() {
return true; return true;
} }
static class JsonData {
String botName;
public JsonData(String botName) {
this.botName = botName;
}
}
} }