mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 07:20:50 +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
|
@Override
|
||||||
public String getWiredData() {
|
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
|
@Override
|
||||||
public void loadWiredData(ResultSet set, Room room) throws SQLException {
|
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) {
|
if (data.length >= 3) {
|
||||||
try {
|
try {
|
||||||
@ -95,6 +107,7 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPickUp() {
|
public void onPickUp() {
|
||||||
@ -112,4 +125,16 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
|
|||||||
public boolean requiresTriggeringUser() {
|
public boolean requiresTriggeringUser() {
|
||||||
return true;
|
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