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
public String getWiredData() {
return this.botName;
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
this.botName
));
}
@Override
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
@ -79,4 +88,12 @@ public class WiredTriggerBotReachedHabbo extends InteractionWiredTrigger {
public boolean isTriggeredByRoomUnit() {
return true;
}
static class JsonData {
String botName;
public JsonData(String botName) {
this.botName = botName;
}
}
}