mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-19 07:56:26 +01:00
WiredConditionNotHabboWearsBadge now saves as JSON
This commit is contained in:
parent
218cb2f3fb
commit
a1bf9d7aa7
@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
|||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboBadge;
|
import com.eu.habbo.habbohotel.users.HabboBadge;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||||
|
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||||
import com.eu.habbo.messages.ClientMessage;
|
import com.eu.habbo.messages.ClientMessage;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
|
||||||
@ -45,12 +46,21 @@ public class WiredConditionNotHabboWearsBadge extends InteractionWiredCondition
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getWiredData() {
|
public String getWiredData() {
|
||||||
return this.badge;
|
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
||||||
|
this.badge
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||||
this.badge = set.getString("wired_data");
|
String wiredData = set.getString("wired_data");
|
||||||
|
|
||||||
|
if (wiredData.startsWith("{")) {
|
||||||
|
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
||||||
|
this.badge = data.badge;
|
||||||
|
} else {
|
||||||
|
this.badge = wiredData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -86,4 +96,12 @@ public class WiredConditionNotHabboWearsBadge extends InteractionWiredCondition
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class JsonData {
|
||||||
|
String badge;
|
||||||
|
|
||||||
|
public JsonData(String badge) {
|
||||||
|
this.badge = badge;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user