mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-12-04 19:46:28 +01:00
WiredConditionNotInTeam now saves as JSON
This commit is contained in:
parent
a1bf9d7aa7
commit
bea21b715e
@ -7,6 +7,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.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;
|
||||||
|
|
||||||
@ -39,16 +40,23 @@ public class WiredConditionNotInTeam extends InteractionWiredCondition {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getWiredData() {
|
public String getWiredData() {
|
||||||
return this.teamColor.type + "";
|
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
||||||
|
this.teamColor
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@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");
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!data.equals(""))
|
String wiredData = set.getString("wired_data");
|
||||||
this.teamColor = GameTeamColors.values()[Integer.valueOf(data)];
|
|
||||||
|
if (wiredData.startsWith("{")) {
|
||||||
|
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
||||||
|
this.teamColor = data.teamColor;
|
||||||
|
} else {
|
||||||
|
if (!wiredData.equals(""))
|
||||||
|
this.teamColor = GameTeamColors.values()[Integer.parseInt(wiredData)];
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.teamColor = GameTeamColors.RED;
|
this.teamColor = GameTeamColors.RED;
|
||||||
}
|
}
|
||||||
@ -88,4 +96,12 @@ public class WiredConditionNotInTeam extends InteractionWiredCondition {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class JsonData {
|
||||||
|
GameTeamColors teamColor;
|
||||||
|
|
||||||
|
public JsonData(GameTeamColors teamColor) {
|
||||||
|
this.teamColor = teamColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user