mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-18 23:46:28 +01:00
WiredEffectGiveHotelviewBonusRarePoints now saves as json
This commit is contained in:
parent
0fc9760894
commit
74e631f00a
@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
|
|||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
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.wired.WiredEffectType;
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
|
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;
|
||||||
import com.eu.habbo.messages.outgoing.hotelview.BonusRareComposer;
|
import com.eu.habbo.messages.outgoing.hotelview.BonusRareComposer;
|
||||||
@ -70,7 +71,7 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff
|
|||||||
packet.readInt();
|
packet.readInt();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.amount = Integer.valueOf(packet.readString());
|
this.amount = Integer.parseInt(packet.readString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -103,20 +104,26 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getWiredData() {
|
public String getWiredData() {
|
||||||
return this.getDelay() + "\t" + this.amount;
|
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(this.getDelay(), this.amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||||
String wireData = set.getString("wired_data");
|
String wiredData = set.getString("wired_data");
|
||||||
this.amount = 0;
|
this.amount = 0;
|
||||||
|
|
||||||
if (wireData.split("\t").length >= 2) {
|
if(wiredData.startsWith("{")) {
|
||||||
super.setDelay(Integer.valueOf(wireData.split("\t")[0]));
|
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
||||||
|
this.setDelay(data.delay);
|
||||||
|
this.amount = data.amount;
|
||||||
|
} else {
|
||||||
|
if (wiredData.split("\t").length >= 2) {
|
||||||
|
super.setDelay(Integer.parseInt(wiredData.split("\t")[0]));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.amount = Integer.valueOf(this.getWiredData().split("\t")[1]);
|
this.amount = Integer.parseInt(this.getWiredData().split("\t")[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,4 +138,14 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff
|
|||||||
public boolean requiresTriggeringUser() {
|
public boolean requiresTriggeringUser() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class JsonData {
|
||||||
|
int delay;
|
||||||
|
int amount;
|
||||||
|
|
||||||
|
public JsonData(int delay, int amount) {
|
||||||
|
this.delay = delay;
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user