mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-26 16:30:52 +01:00
WiredConditionNotHabboHasEffect now saves as JSON
This commit is contained in:
parent
ecfeaa9a5f
commit
218cb2f3fb
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
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.ServerMessage;
|
||||
|
||||
@ -32,12 +33,21 @@ public class WiredConditionNotHabboHasEffect extends InteractionWiredCondition {
|
||||
|
||||
@Override
|
||||
public String getWiredData() {
|
||||
return this.effectId + "";
|
||||
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
||||
this.effectId
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||
this.effectId = Integer.valueOf(set.getString("wired_data"));
|
||||
String wiredData = set.getString("wired_data");
|
||||
|
||||
if (wiredData.startsWith("{")) {
|
||||
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
||||
this.effectId = data.effectId;
|
||||
} else {
|
||||
this.effectId = Integer.parseInt(wiredData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -73,4 +83,12 @@ public class WiredConditionNotHabboHasEffect extends InteractionWiredCondition {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
int effectId;
|
||||
|
||||
public JsonData(int effectId) {
|
||||
this.effectId = effectId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user