diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java index 87ec676b..f216e3c8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java @@ -1,6 +1,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.IWiredInteraction; @@ -9,8 +10,11 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.wired.WiredExclusionStrategy; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.messages.ClientMessage; -import com.eu.habbo.messages.incoming.wired.WiredSaveException; +import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.rooms.items.OneWayDoorStatusMessageComposer; +import com.eu.habbo.messages.outgoing.wired.WiredConditionDataComposer; +import com.eu.habbo.messages.outgoing.wired.WiredEffectDataComposer; +import com.eu.habbo.messages.outgoing.wired.WiredTriggerDataComposer; import gnu.trove.map.hash.TLongLongHashMap; import lombok.Getter; import lombok.Setter; @@ -25,10 +29,6 @@ import java.util.List; @Slf4j public abstract class InteractionWired extends InteractionDefault implements IWiredInteraction { - @Getter - @Setter - private String wiredData; - @Getter @Setter private WiredSettings wiredSettings; @@ -38,20 +38,111 @@ public abstract class InteractionWired extends InteractionDefault implements IWi public InteractionWired(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.wiredData = ""; this.wiredSettings = new WiredSettings(); this.setExtradata("0"); } InteractionWired(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { super(id, userId, item, extradata, limitedStack, limitedSells); - this.wiredData = ""; this.wiredSettings = new WiredSettings(); this.setExtradata("0"); } public abstract boolean execute(RoomUnit roomUnit, Room room, Object[] stuff); + /** + * On Room Loading run this, get Wired Data from Database and save it into the item + * + * @param set + * @throws SQLException + */ + public void loadWiredSettings(ResultSet set) throws SQLException { + String wiredData = set.getString("wired_data"); + + this.wiredSettings = new WiredSettings(); + + if(wiredData.startsWith("{")) { + this.wiredSettings = WiredHandler.getGsonBuilder().create().fromJson(wiredData, WiredSettings.class); + } + + this.loadDefaultParams(); + } + + /** + * + * When double clicking into the wired, verify items first and load its default parameters + * then create a composer based on it's Wired Settings + * + * @param client + * @param room + * @param objects + * @throws Exception + */ + @Override + public void onClick(GameClient client, Room room, Object[] objects) throws Exception { + this.wiredSettings.getItems(room); + + //TODO Im not sure about this, the function is optional on its children maybe later just make it abstract + this.loadDefaultParams(); + + if (client != null) { + if (room.hasRights(client.getHabbo())) { + MessageComposer composer = null; + if(this instanceof InteractionWiredEffect) { + composer = new WiredEffectDataComposer((InteractionWiredEffect) this, room); + } else if(this instanceof InteractionWiredCondition) { + composer = new WiredConditionDataComposer((InteractionWiredCondition) this, room); + } else if(this instanceof InteractionWiredTrigger) { + composer = new WiredTriggerDataComposer((InteractionWiredTrigger) this, room); + } + + client.sendResponse(composer); + this.activateBox(room); + } + } + } + + /** + * When click save changes on the wired this executes, reads all the packet + * And updates wired current Wired Settings + * + * @param packet + */ + public void saveWiredSettings(ClientMessage packet) { + int intParamCount = packet.readInt(); + List integerParams = new ArrayList<>(); + + for(int i = 0; i < intParamCount; i++) + { + integerParams.add(packet.readInt()); + } + + this.wiredSettings.setIntegerParams(integerParams); + this.wiredSettings.setStringParam(packet.readString()); + + int itemCount = packet.readInt(); + List itemIds = new ArrayList<>(); + + for(int i = 0; i < itemCount; i++) + { + itemIds.add(packet.readInt()); + } + + this.wiredSettings.setItemIds(itemIds); + + if(this instanceof InteractionWiredEffect) { + this.wiredSettings.setDelay(packet.readInt()); + } + + this.wiredSettings.setSelectionType(packet.readInt()); + } + + /** + * This is executed on 3 different situations + * When finishing executing: `saveWiredSettings`, when placing this item on floor, and when picking it up. + * This what it does is converts Wired Settings into a JSON string + * and updates wired_data in the database + */ @Override public void run() { if (this.needsUpdate()) { @@ -62,6 +153,10 @@ public abstract class InteractionWired extends InteractionDefault implements IWi String wiredData = WiredHandler.getGsonBuilder().setExclusionStrategies(exclusionStrategy).create().toJson(this.wiredSettings); + if(wiredData.equalsIgnoreCase("{}")) { + wiredData = ""; + } + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE items SET wired_data = ? WHERE id = ?")) { if (this.getRoomId() != 0) { statement.setString(1, wiredData); @@ -77,12 +172,18 @@ public abstract class InteractionWired extends InteractionDefault implements IWi super.run(); } + /** + * When picking up the wired, all its settings are erased and updated in database + * + * @param room + */ @Override public void onPickUp(Room room) { - this.wiredSettings = null; - //TODO not sure about this + this.wiredSettings.dispose(); } + public void loadDefaultParams() {} + public void activateBox(Room room) { this.activateBox(room, null, 0L); } @@ -123,7 +224,6 @@ public abstract class InteractionWired extends InteractionDefault implements IWi long lastTimestamp = this.userExecutionCache.get(roomUnitId); return timestamp - lastTimestamp >= 100L; } - } return true; } @@ -135,50 +235,4 @@ public abstract class InteractionWired extends InteractionDefault implements IWi public void addUserExecutionCache(int roomUnitId, long timestamp) { this.userExecutionCache.put(roomUnitId, timestamp); } - - public void loadWiredSettings(ClientMessage packet, boolean isWiredEffect) { - WiredSettings settings = new WiredSettings(); - - int intParamCount = packet.readInt(); - List integerParams = new ArrayList<>(); - - for(int i = 0; i < intParamCount; i++) - { - integerParams.add(packet.readInt()); - } - - settings.setIntegerParams(integerParams); - settings.setStringParam(packet.readString()); - - int itemCount = packet.readInt(); - List itemIds = new ArrayList<>(); - - for(int i = 0; i < itemCount; i++) - { - itemIds.add(packet.readInt()); - } - - settings.setItemIds(itemIds); - - if(isWiredEffect) - { - settings.setDelay(packet.readInt()); - } - - settings.setSelectionType(packet.readInt()); - - this.wiredSettings = settings; - } - - public void loadWiredSettings(ResultSet set, Room room) throws SQLException { - String wiredData = set.getString("wired_data"); - - WiredSettings settings = new WiredSettings(); - - if(wiredData.startsWith("{")) { - settings = WiredHandler.getGsonBuilder().create().fromJson(wiredData, WiredSettings.class); - } - - this.wiredSettings = settings; - } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java index d21ec978..a9b85cce 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java @@ -19,16 +19,6 @@ public abstract class InteractionWiredCondition extends InteractionWired { super(id, userId, item, extradata, limitedStack, limitedSells); } - @Override - public void onClick(GameClient client, Room room, Object[] objects) { - if (client != null) { - if (room.hasRights(client.getHabbo())) { - client.sendResponse(new WiredConditionDataComposer(this, room)); - this.activateBox(room); - } - } - } - public abstract WiredConditionType getType(); public WiredConditionOperator operator() { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java index e53b9da9..b9bef234 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java @@ -48,16 +48,6 @@ public abstract class InteractionWiredEffect extends InteractionWired implements return blockedTriggers; } - @Override - public void onClick(GameClient client, Room room, Object[] objects) throws Exception { - if (client != null) { - if (room.hasRights(client.getHabbo())) { - client.sendResponse(new WiredEffectDataComposer(this, room)); - this.activateBox(room); - } - } - } - public boolean requiresTriggeringUser() { return false; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java index 7a9af300..be6fc806 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java @@ -45,18 +45,7 @@ public abstract class InteractionWiredTrigger extends InteractionWired implement return blockedEffects; } - @Override - public void onClick(GameClient client, Room room, Object[] objects) { - if (client != null) { - if (room.hasRights(client.getHabbo())) { - client.sendResponse(new WiredTriggerDataComposer(this, room)); - this.activateBox(room); - } - } - } - public boolean isTriggeredByRoomUnit() { return false; } - } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/WiredSettings.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/WiredSettings.java index a3c35255..8fdba9dc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/WiredSettings.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/WiredSettings.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired; import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.IWiredSettings; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; @@ -29,7 +30,7 @@ public class WiredSettings implements IWiredSettings { @Getter @Setter - private int selectionType; + private transient int selectionType; public WiredSettings() { this.itemIds = new ArrayList<>(); @@ -42,11 +43,15 @@ public class WiredSettings implements IWiredSettings { public THashSet getItems(Room room) { THashSet items = new THashSet<>(); - for(int itemId : this.itemIds) { - HabboItem item = room.getHabboItem(itemId); + if(this.itemIds.size() == 0) { + return items; + } + + for(int i = 0; i < this.itemIds.size(); i++) { + HabboItem item = room.getHabboItem(this.itemIds.get(i)); if(item == null || item.getRoomId() == 0) { - this.itemIds.remove(itemId); + this.itemIds.remove(i); continue; } @@ -55,4 +60,12 @@ public class WiredSettings implements IWiredSettings { return items; } + + public void dispose() { + this.integerParams.clear(); + this.itemIds.clear(); + this.stringParam = ""; + this.delay = 0; + this.selectionType = 0; + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java index 6b71d159..b6257b58 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java @@ -32,6 +32,14 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement super(id, userId, item, extradata, limitedStack, limitedSells); } + @Override + public void loadDefaultParams() { + if(this.getWiredSettings().getIntegerParams().size() == 0) { + this.getWiredSettings().getIntegerParams().add(0); + this.getWiredSettings().getIntegerParams().add(0); + } + } + @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { if(this.getWiredSettings().getItemIds().isEmpty()) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/interfaces/IWiredInteraction.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/interfaces/IWiredInteraction.java index a3533e27..fc6f20f9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/interfaces/IWiredInteraction.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/interfaces/IWiredInteraction.java @@ -4,8 +4,6 @@ import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; public interface IWiredInteraction { - String getWiredData(); - void setWiredData(String value); WiredSettings getWiredSettings(); void setWiredSettings(WiredSettings value); boolean execute(RoomUnit roomUnit, Room room, Object[] stuff); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboEntersRoom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboEntersRoom.java index 96658240..c6b86584 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboEntersRoom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboEntersRoom.java @@ -2,18 +2,16 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; 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.messages.ServerMessage; import java.sql.ResultSet; import java.sql.SQLException; public class WiredTriggerHabboEntersRoom extends InteractionWiredTrigger { + public final int PARAM_ANY_USER = 0; public WiredTriggerHabboEntersRoom(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); } @@ -24,7 +22,9 @@ public class WiredTriggerHabboEntersRoom extends InteractionWiredTrigger { @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - if(this.getWiredSettings().getStringParam().isEmpty()) { + boolean anyUser = this.getWiredSettings().getIntegerParams().get(PARAM_ANY_USER) == 0; + + if(this.getWiredSettings().getStringParam().isEmpty() && !anyUser || anyUser) { return true; } @@ -37,6 +37,13 @@ public class WiredTriggerHabboEntersRoom extends InteractionWiredTrigger { return false; } + @Override + public void loadDefaultParams() { + if(this.getWiredSettings().getIntegerParams().size() == 0) { + this.getWiredSettings().getIntegerParams().add(0); + } + } + @Override public WiredTriggerType getType() { return WiredTriggerType.ENTER_ROOM; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysKeyword.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysKeyword.java index fcf60b01..18b05113 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysKeyword.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboSaysKeyword.java @@ -24,6 +24,13 @@ public class WiredTriggerHabboSaysKeyword extends InteractionWiredTrigger { super(id, userId, item, extraData, limitedStack, limitedSells); } + @Override + public void loadDefaultParams() { + if(this.getWiredSettings().getIntegerParams().size() == 0) { + this.getWiredSettings().getIntegerParams().add(0); + } + } + @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { if (this.getWiredSettings().getStringParam().isEmpty()) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java index 42911bf3..a6b2d407 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java @@ -32,23 +32,14 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICy } @Override - public void cycle(Room room) { - if(this.getWiredSettings() == null) { - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) { - try (PreparedStatement statement = connection.prepareStatement("SELECT id, wired_data FROM items WHERE room_id = ? AND wired_data<>''")) { - statement.setInt(1, room.getId()); - - try (ResultSet set = statement.executeQuery()) { - while (set.next()) { - this.loadWiredSettings(set, room); - } - } - } - } catch (SQLException e) { - throw new RuntimeException(e); - } + public void loadDefaultParams() { + if(this.getWiredSettings().getIntegerParams().size() == 0) { + this.getWiredSettings().getIntegerParams().add(1); } + } + @Override + public void cycle(Room room) { this.counter += 500; if (this.counter >= this.getWiredSettings().getIntegerParams().get(PARAM_REPEAT_TIME) * 500) { this.counter = 0; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java index 41c21c74..58314aa2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java @@ -14,9 +14,7 @@ import java.sql.ResultSet; import java.sql.SQLException; public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements ICycleable, WiredTriggerReset { - public static final int DEFAULT_DELAY = 10 * 5000; private static final int PARAM_REPEAT_TIME = 0; - private int repeatTime = DEFAULT_DELAY; private int counter = 0; public WiredTriggerRepeaterLong(ResultSet set, Item baseItem) throws SQLException { @@ -32,6 +30,13 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements return true; } + @Override + public void loadDefaultParams() { + if(this.getWiredSettings().getIntegerParams().size() == 0) { + this.getWiredSettings().getIntegerParams().add(1); + } + } + @Override public void cycle(Room room) { this.counter += 500; diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index e2f2d113..d1141146 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -498,7 +498,7 @@ public class Room implements Comparable, ISerialize, Runnable { HabboItem item = this.getHabboItem(set.getInt("id")); if (item instanceof InteractionWired interactionWired) { - interactionWired.loadWiredSettings(set, this); + interactionWired.loadWiredSettings(set); } } catch (SQLException e) { log.error(CAUGHT_SQL_EXCEPTION, e); diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateActionEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateActionEvent.java index 78f8629c..2c86e59f 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateActionEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateActionEvent.java @@ -1,9 +1,7 @@ package com.eu.habbo.messages.incoming.wired; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.items.interactions.InteractionWired; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.messages.incoming.MessageHandler; @@ -28,7 +26,7 @@ public class UpdateActionEvent extends MessageHandler { throw new WiredSaveException(String.format("Wired effect with item id %s not found in room", itemId)); } - effect.loadWiredSettings(this.packet, true); + effect.saveWiredSettings(this.packet); this.client.sendResponse(new WiredSavedComposer()); effect.needsUpdate(true); Emulator.getThreading().run(effect); diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateConditionEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateConditionEvent.java index c22ad8e3..55f95f27 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateConditionEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateConditionEvent.java @@ -1,9 +1,7 @@ package com.eu.habbo.messages.incoming.wired; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.items.interactions.InteractionWired; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.messages.incoming.MessageHandler; @@ -26,7 +24,7 @@ public class UpdateConditionEvent extends MessageHandler { throw new WiredSaveException(String.format("Wired condition with item id %s not found in room", itemId)); } - condition.loadWiredSettings(this.packet, true); + condition.saveWiredSettings(this.packet); this.client.sendResponse(new WiredSavedComposer()); condition.needsUpdate(true); Emulator.getThreading().run(condition); diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateTriggerEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateTriggerEvent.java index d58e73cd..b251c097 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateTriggerEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/wired/UpdateTriggerEvent.java @@ -1,9 +1,7 @@ package com.eu.habbo.messages.incoming.wired; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.items.interactions.InteractionWired; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.messages.incoming.MessageHandler; @@ -26,7 +24,7 @@ public class UpdateTriggerEvent extends MessageHandler { throw new WiredSaveException(String.format("Wired trigger with item id %s not found in room", itemId)); } - trigger.loadWiredSettings(this.packet, false); + trigger.saveWiredSettings(this.packet); this.client.sendResponse(new WiredSavedComposer()); trigger.needsUpdate(true); Emulator.getThreading().run(trigger); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredConditionDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredConditionDataComposer.java index 2f05e67a..ed3c8305 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredConditionDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredConditionDataComposer.java @@ -16,7 +16,6 @@ public class WiredConditionDataComposer extends MessageComposer { @Override protected ServerMessage composeInternal() { this.response.init(Outgoing.wiredConditionDataComposer); -// this.condition.serializeWiredData(this.response, this.room); @DEPRECATED this.response.appendBoolean(false); this.response.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredEffectDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredEffectDataComposer.java index b3b87a45..be8e0ae6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredEffectDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredEffectDataComposer.java @@ -17,8 +17,6 @@ public class WiredEffectDataComposer extends MessageComposer { protected ServerMessage composeInternal() { this.response.init(Outgoing.wiredEffectDataComposer); -// this.effect.serializeWiredData(this.response, this.room); @DEPRECATED - this.response.appendBoolean(false); this.response.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION); this.response.appendInt(this.effect.getWiredSettings().getItemIds().size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredTriggerDataComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredTriggerDataComposer.java index 3031e4df..706a60fa 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredTriggerDataComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/wired/WiredTriggerDataComposer.java @@ -16,7 +16,6 @@ public class WiredTriggerDataComposer extends MessageComposer { @Override protected ServerMessage composeInternal() { this.response.init(Outgoing.wiredTriggerDataComposer); -// this.trigger.serializeWiredData(this.response, this.room); @DEPRECATED this.response.appendBoolean(false); this.response.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION);