mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-27 00:40:52 +01:00
WiredEffectMuteHabbo now saves as json
This commit is contained in:
parent
9341d164a9
commit
b1e9276940
@ -79,12 +79,24 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
|
||||
|
||||
@Override
|
||||
public String getWiredData() {
|
||||
return this.getDelay() + "\t" + this.length + "\t" + this.message;
|
||||
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
||||
this.getDelay(),
|
||||
this.length,
|
||||
this.message
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
||||
String[] data = set.getString("wired_data").split("\t");
|
||||
String wiredData = set.getString("wired_data");
|
||||
|
||||
if (wiredData.startsWith("{")) {
|
||||
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
||||
this.setDelay(data.delay);
|
||||
this.length = data.length;
|
||||
this.message = data.message;
|
||||
} else {
|
||||
String[] data = wiredData.split("\t");
|
||||
|
||||
if (data.length >= 3) {
|
||||
try {
|
||||
@ -95,6 +107,7 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickUp() {
|
||||
@ -112,4 +125,16 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
|
||||
public boolean requiresTriggeringUser() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static class JsonData {
|
||||
int delay;
|
||||
int length;
|
||||
String message;
|
||||
|
||||
public JsonData(int delay, int length, String message) {
|
||||
this.delay = delay;
|
||||
this.length = length;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user