mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 07:20:50 +01:00
WiredData now saves as JSON import fixes
This commit is contained in:
parent
5720adf61c
commit
75b61b1809
@ -19,6 +19,8 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implements ICycleable {
|
public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implements ICycleable {
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
|||||||
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.rooms.users.RoomUserWhisperComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
|
||||||
|
@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
|||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
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.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.threading.runnables.WiredResetTimers;
|
import com.eu.habbo.threading.runnables.WiredResetTimers;
|
||||||
@ -92,15 +93,15 @@ public class WiredEffectResetTimers extends InteractionWiredEffect {
|
|||||||
|
|
||||||
@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");
|
String wiredData = set.getString("wired_data");
|
||||||
|
|
||||||
if (data.startsWith("{")) {
|
if (wiredData.startsWith("{")) {
|
||||||
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class);
|
||||||
this.delay = data.delay;
|
this.delay = data.delay;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
if (!data.equals("")) {
|
if (!wiredData.equals("")) {
|
||||||
this.delay = Integer.valueOf(data);
|
this.delay = Integer.parseInt(wiredData);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class WiredEffectTeleport extends InteractionWiredEffect {
|
public class WiredEffectTeleport extends InteractionWiredEffect {
|
||||||
public static final WiredEffectType type = WiredEffectType.TELEPORT;
|
public static final WiredEffectType type = WiredEffectType.TELEPORT;
|
||||||
@ -182,7 +183,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
|
|||||||
@Override
|
@Override
|
||||||
public String getWiredData() {
|
public String getWiredData() {
|
||||||
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
return WiredHandler.getGsonBuilder().create().toJson(new JsonData(
|
||||||
this.delay,
|
this.getDelay(),
|
||||||
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
|
this.items.stream().map(HabboItem::getId).collect(Collectors.toList())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -205,12 +206,12 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
|
|||||||
String[] wiredDataOld = wiredData.split("\t");
|
String[] wiredDataOld = wiredData.split("\t");
|
||||||
|
|
||||||
if (wiredDataOld.length >= 1) {
|
if (wiredDataOld.length >= 1) {
|
||||||
this.setDelay(Integer.valueOf(wiredDataOld[0]));
|
this.setDelay(Integer.parseInt(wiredDataOld[0]));
|
||||||
}
|
}
|
||||||
if (wiredDataOld.length == 2) {
|
if (wiredDataOld.length == 2) {
|
||||||
if (wiredDataOld[1].contains(";")) {
|
if (wiredDataOld[1].contains(";")) {
|
||||||
for (String s : wiredDataOld[1].split(";")) {
|
for (String s : wiredDataOld[1].split(";")) {
|
||||||
HabboItem item = room.getHabboItem(Integer.valueOf(s));
|
HabboItem item = room.getHabboItem(Integer.parseInt(s));
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
this.items.add(item);
|
this.items.add(item);
|
||||||
|
@ -35,6 +35,7 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class WiredEffectToggleFurni extends InteractionWiredEffect {
|
public class WiredEffectToggleFurni extends InteractionWiredEffect {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectToggleFurni.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectToggleFurni.class);
|
||||||
@ -193,7 +194,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
|
|||||||
int state = 0;
|
int state = 0;
|
||||||
if (!item.getExtradata().isEmpty()) {
|
if (!item.getExtradata().isEmpty()) {
|
||||||
try {
|
try {
|
||||||
state = Integer.valueOf(item.getExtradata()); // assumes that extradata is state, could be something else for trophies etc.
|
state = Integer.parseInt(item.getExtradata()); // assumes that extradata is state, could be something else for trophies etc.
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -241,12 +242,12 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
|
|||||||
String[] wiredDataOld = wiredData.split("\t");
|
String[] wiredDataOld = wiredData.split("\t");
|
||||||
|
|
||||||
if (wiredDataOld.length >= 1) {
|
if (wiredDataOld.length >= 1) {
|
||||||
this.setDelay(Integer.valueOf(wiredDataOld[0]));
|
this.setDelay(Integer.parseInt(wiredDataOld[0]));
|
||||||
}
|
}
|
||||||
if (wiredDataOld.length == 2) {
|
if (wiredDataOld.length == 2) {
|
||||||
if (wiredDataOld[1].contains(";")) {
|
if (wiredDataOld[1].contains(";")) {
|
||||||
for (String s : wiredDataOld[1].split(";")) {
|
for (String s : wiredDataOld[1].split(";")) {
|
||||||
HabboItem item = room.getHabboItem(Integer.valueOf(s));
|
HabboItem item = room.getHabboItem(Integer.parseInt(s));
|
||||||
|
|
||||||
if (item instanceof InteractionFreezeBlock || item instanceof InteractionFreezeTile || item instanceof InteractionCrackable)
|
if (item instanceof InteractionFreezeBlock || item instanceof InteractionFreezeTile || item instanceof InteractionCrackable)
|
||||||
continue;
|
continue;
|
||||||
|
@ -32,6 +32,7 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class WiredEffectToggleRandom extends InteractionWiredEffect {
|
public class WiredEffectToggleRandom extends InteractionWiredEffect {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectToggleRandom.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectToggleRandom.class);
|
||||||
@ -219,12 +220,12 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect {
|
|||||||
String[] wiredDataOld = wiredData.split("\t");
|
String[] wiredDataOld = wiredData.split("\t");
|
||||||
|
|
||||||
if (wiredDataOld.length >= 1) {
|
if (wiredDataOld.length >= 1) {
|
||||||
this.setDelay(Integer.valueOf(wiredDataOld[0]));
|
this.setDelay(Integer.parseInt(wiredDataOld[0]));
|
||||||
}
|
}
|
||||||
if (wiredDataOld.length == 2) {
|
if (wiredDataOld.length == 2) {
|
||||||
if (wiredDataOld[1].contains(";")) {
|
if (wiredDataOld[1].contains(";")) {
|
||||||
for (String s : wiredDataOld[1].split(";")) {
|
for (String s : wiredDataOld[1].split(";")) {
|
||||||
HabboItem item = room.getHabboItem(Integer.valueOf(s));
|
HabboItem item = room.getHabboItem(Integer.parseInt(s));
|
||||||
|
|
||||||
if (item instanceof InteractionFreezeBlock || item instanceof InteractionGameTimer || item instanceof InteractionCrackable)
|
if (item instanceof InteractionFreezeBlock || item instanceof InteractionGameTimer || item instanceof InteractionCrackable)
|
||||||
continue;
|
continue;
|
||||||
|
@ -21,6 +21,7 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class WiredEffectTriggerStacks extends InteractionWiredEffect {
|
public class WiredEffectTriggerStacks extends InteractionWiredEffect {
|
||||||
public static final WiredEffectType type = WiredEffectType.CALL_STACKS;
|
public static final WiredEffectType type = WiredEffectType.CALL_STACKS;
|
||||||
@ -180,12 +181,12 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
|
|||||||
String[] wiredDataOld = wiredData.split("\t");
|
String[] wiredDataOld = wiredData.split("\t");
|
||||||
|
|
||||||
if (wiredDataOld.length >= 1) {
|
if (wiredDataOld.length >= 1) {
|
||||||
this.setDelay(Integer.valueOf(wiredDataOld[0]));
|
this.setDelay(Integer.parseInt(wiredDataOld[0]));
|
||||||
}
|
}
|
||||||
if (wiredDataOld.length == 2) {
|
if (wiredDataOld.length == 2) {
|
||||||
if (wiredDataOld[1].contains(";")) {
|
if (wiredDataOld[1].contains(";")) {
|
||||||
for (String s : wiredDataOld[1].split(";")) {
|
for (String s : wiredDataOld[1].split(";")) {
|
||||||
HabboItem item = room.getHabboItem(Integer.valueOf(s));
|
HabboItem item = room.getHabboItem(Integer.parseInt(s));
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
this.items.add(item);
|
this.items.add(item);
|
||||||
|
@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
|||||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
|
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
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.wired.WiredHandler;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
import com.eu.habbo.messages.ClientMessage;
|
import com.eu.habbo.messages.ClientMessage;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
@ -53,7 +54,7 @@ public class WiredTriggerAtSetTime extends InteractionWiredTrigger implements Wi
|
|||||||
this.executeTime = data.executeTime;
|
this.executeTime = data.executeTime;
|
||||||
} else {
|
} else {
|
||||||
if (wiredData.length() >= 1) {
|
if (wiredData.length() >= 1) {
|
||||||
this.executeTime = (Integer.valueOf(wiredData));
|
this.executeTime = (Integer.parseInt(wiredData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
|||||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
|
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
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.wired.WiredHandler;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
import com.eu.habbo.messages.ClientMessage;
|
import com.eu.habbo.messages.ClientMessage;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
@ -52,7 +53,7 @@ public class WiredTriggerAtTimeLong extends InteractionWiredTrigger implements W
|
|||||||
this.executeTime = data.executeTime;
|
this.executeTime = data.executeTime;
|
||||||
} else {
|
} else {
|
||||||
if (wiredData.length() >= 1) {
|
if (wiredData.length() >= 1) {
|
||||||
this.executeTime = (Integer.valueOf(wiredData));
|
this.executeTime = (Integer.parseInt(wiredData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger {
|
public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(WiredTriggerBotReachedFurni.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(WiredTriggerBotReachedFurni.class);
|
||||||
@ -154,9 +155,9 @@ public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger {
|
|||||||
|
|
||||||
String[] items = data[1].split(";");
|
String[] items = data[1].split(";");
|
||||||
|
|
||||||
for (int i = 0; i < items.length; i++) {
|
for (String id : items) {
|
||||||
try {
|
try {
|
||||||
HabboItem item = room.getHabboItem(Integer.valueOf(items[i]));
|
HabboItem item = room.getHabboItem(Integer.parseInt(id));
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
this.items.add(item);
|
this.items.add(item);
|
||||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item;
|
|||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
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.wired.WiredHandler;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
import com.eu.habbo.messages.ClientMessage;
|
import com.eu.habbo.messages.ClientMessage;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
|||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
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.WiredHandler;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
import com.eu.habbo.messages.ClientMessage;
|
import com.eu.habbo.messages.ClientMessage;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
|||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
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.WiredHandler;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
import com.eu.habbo.messages.ClientMessage;
|
import com.eu.habbo.messages.ClientMessage;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item;
|
|||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
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.wired.WiredHandler;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
import com.eu.habbo.messages.ClientMessage;
|
import com.eu.habbo.messages.ClientMessage;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
@ -51,7 +52,7 @@ public class WiredTriggerScoreAchieved extends InteractionWiredTrigger {
|
|||||||
this.score = data.score;
|
this.score = data.score;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
this.score = Integer.valueOf(wiredData);
|
this.score = Integer.parseInt(wiredData);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user