From b781f1d731f9d712e903fd26d4a796954a8e1dfb Mon Sep 17 00:00:00 2001 From: Remco Date: Mon, 4 Jan 2021 08:19:56 -0500 Subject: [PATCH] WiredTriggerBotReachedHabbo now saves as json --- .../triggers/WiredTriggerBotReachedHabbo.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java index 161f2acf..2174d868 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java @@ -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; + } + } }