From d3762c9b87e646978e4da4fb357a4097e77d0abd Mon Sep 17 00:00:00 2001 From: Harmonic Date: Wed, 20 Apr 2022 23:55:55 +0000 Subject: [PATCH] Revert "Merge branch 'refactor/wired-saving' into 'dev'" This reverts merge request !507 --- .../items/interactions/InteractionWired.java | 33 ---------- .../InteractionWiredCondition.java | 4 +- .../interactions/InteractionWiredEffect.java | 4 +- .../interactions/InteractionWiredTrigger.java | 3 +- .../interactions/wired/WiredSettings.java | 63 ------------------- .../WiredConditionDateRangeActive.java | 11 ++-- .../WiredConditionFurniHaveFurni.java | 14 +++-- .../WiredConditionFurniHaveHabbo.java | 36 +++++++---- .../WiredConditionFurniTypeMatch.java | 10 +-- .../conditions/WiredConditionGroupMember.java | 3 +- .../conditions/WiredConditionHabboCount.java | 10 +-- .../WiredConditionHabboHasEffect.java | 8 +-- .../WiredConditionHabboHasHandItem.java | 8 +-- .../WiredConditionHabboWearsBadge.java | 7 ++- .../WiredConditionLessTimeElapsed.java | 9 +-- .../WiredConditionMatchStatePosition.java | 19 +++--- .../WiredConditionMoreTimeElapsed.java | 9 +-- .../WiredConditionNotFurniHaveFurni.java | 14 +++-- .../WiredConditionNotFurniHaveHabbo.java | 38 +++++++---- .../WiredConditionNotFurniTypeMatch.java | 10 +-- .../WiredConditionNotHabboCount.java | 10 +-- .../WiredConditionNotHabboHasEffect.java | 8 +-- .../WiredConditionNotHabboWearsBadge.java | 7 ++- .../conditions/WiredConditionNotInGroup.java | 3 +- .../conditions/WiredConditionNotInTeam.java | 8 +-- .../conditions/WiredConditionTeamMember.java | 8 +-- .../WiredConditionTriggerOnFurni.java | 10 +-- .../wired/effects/WiredEffectBotClothes.java | 11 ++-- .../effects/WiredEffectBotFollowHabbo.java | 15 +++-- .../effects/WiredEffectBotGiveHandItem.java | 14 ++--- .../wired/effects/WiredEffectBotTalk.java | 14 +++-- .../effects/WiredEffectBotTalkToHabbo.java | 14 +++-- .../wired/effects/WiredEffectBotTeleport.java | 12 ++-- .../effects/WiredEffectBotWalkToFurni.java | 12 ++-- .../WiredEffectChangeFurniDirection.java | 18 +++--- ...redEffectGiveHotelviewBonusRarePoints.java | 10 +-- .../WiredEffectGiveHotelviewHofPoints.java | 11 ++-- .../wired/effects/WiredEffectGiveRespect.java | 10 +-- .../wired/effects/WiredEffectGiveReward.java | 19 +++--- .../wired/effects/WiredEffectGiveScore.java | 14 +++-- .../effects/WiredEffectGiveScoreToTeam.java | 16 ++--- .../wired/effects/WiredEffectJoinTeam.java | 12 ++-- .../wired/effects/WiredEffectKickHabbo.java | 9 +-- .../wired/effects/WiredEffectLeaveTeam.java | 8 ++- .../wired/effects/WiredEffectMatchFurni.java | 20 +++--- .../effects/WiredEffectMoveFurniAway.java | 11 ++-- .../wired/effects/WiredEffectMoveFurniTo.java | 18 +++--- .../effects/WiredEffectMoveFurniTowards.java | 12 ++-- .../effects/WiredEffectMoveRotateFurni.java | 18 +++--- .../wired/effects/WiredEffectMuteHabbo.java | 15 ++--- .../wired/effects/WiredEffectResetTimers.java | 10 ++- .../wired/effects/WiredEffectTeleport.java | 12 ++-- .../wired/effects/WiredEffectToggleFurni.java | 12 ++-- .../effects/WiredEffectToggleRandom.java | 12 ++-- .../effects/WiredEffectTriggerStacks.java | 12 ++-- .../wired/effects/WiredEffectWhisper.java | 13 ++-- .../wired/triggers/WiredTriggerAtSetTime.java | 7 +-- .../triggers/WiredTriggerAtTimeLong.java | 8 +-- .../triggers/WiredTriggerBotReachedFurni.java | 11 ++-- .../triggers/WiredTriggerBotReachedHabbo.java | 7 ++- .../wired/triggers/WiredTriggerCollision.java | 3 +- .../WiredTriggerFurniStateToggled.java | 10 +-- .../wired/triggers/WiredTriggerGameEnds.java | 3 +- .../triggers/WiredTriggerGameStarts.java | 3 +- .../triggers/WiredTriggerHabboEntersRoom.java | 6 +- .../WiredTriggerHabboSaysKeyword.java | 9 ++- .../WiredTriggerHabboWalkOffFurni.java | 10 +-- .../WiredTriggerHabboWalkOnFurni.java | 10 +-- .../wired/triggers/WiredTriggerRepeater.java | 8 +-- .../triggers/WiredTriggerRepeaterLong.java | 8 +-- .../triggers/WiredTriggerScoreAchieved.java | 7 +-- .../wired/WiredConditionSaveDataEvent.java | 9 +-- .../wired/WiredEffectSaveDataEvent.java | 6 +- .../wired/WiredTriggerSaveDataEvent.java | 9 +-- 74 files changed, 426 insertions(+), 459 deletions(-) delete mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/WiredSettings.java 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 166768cb..8a8f1e7f 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 @@ -2,10 +2,8 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; -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.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer; import gnu.trove.map.hash.TLongLongHashMap; @@ -128,35 +126,4 @@ public abstract class InteractionWired extends InteractionDefault { public void addUserExecutionCache(int roomUnitId, long timestamp) { this.userExecutionCache.put((long)roomUnitId, timestamp); } - - public static WiredSettings readSettings(ClientMessage packet, boolean isEffect) - { - int intParamCount = packet.readInt(); - int[] intParams = new int[intParamCount]; - - for(int i = 0; i < intParamCount; i++) - { - intParams[i] = packet.readInt(); - } - - String stringParam = packet.readString(); - - int itemCount = packet.readInt(); - int[] itemIds = new int[itemCount]; - - for(int i = 0; i < itemCount; i++) - { - itemIds[i] = packet.readInt(); - } - - WiredSettings settings = new WiredSettings(intParams, stringParam, itemIds, -1); - - if(isEffect) - { - settings.setDelay(packet.readInt()); - } - - settings.setStuffTypeSelectionCode(packet.readInt()); - return 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 ef63491f..7bf21fe1 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 @@ -2,11 +2,11 @@ package com.eu.habbo.habbohotel.items.interactions; 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.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.wired.WiredConditionOperator; import com.eu.habbo.habbohotel.wired.WiredConditionType; +import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.outgoing.wired.WiredConditionDataComposer; import java.sql.ResultSet; @@ -43,7 +43,7 @@ public abstract class InteractionWiredCondition extends InteractionWired { public abstract WiredConditionType getType(); - public abstract boolean saveData(WiredSettings settings); + public abstract boolean saveData(ClientMessage packet); public WiredConditionOperator operator() { return WiredConditionOperator.AND; 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 e58e3659..59da2b6f 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 @@ -2,10 +2,10 @@ package com.eu.habbo.habbohotel.items.interactions; 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.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.wired.WiredEffectType; +import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.messages.outgoing.wired.WiredEffectDataComposer; @@ -43,7 +43,7 @@ public abstract class InteractionWiredEffect extends InteractionWired { } } - public abstract boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException; + public abstract boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException; public int getDelay() { return this.delay; 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 91fb8c08..c0bbaabb 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 @@ -2,7 +2,6 @@ package com.eu.habbo.habbohotel.items.interactions; 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.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.wired.WiredTriggerType; @@ -45,7 +44,7 @@ public abstract class InteractionWiredTrigger extends InteractionWired { public abstract WiredTriggerType getType(); - public abstract boolean saveData(WiredSettings settings); + public abstract boolean saveData(ClientMessage packet); protected int getDelay() { return this.delay; 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 deleted file mode 100644 index b6027a06..00000000 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/WiredSettings.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.eu.habbo.habbohotel.items.interactions.wired; - -public class WiredSettings { - private int[] intParams; - private String stringParam; - private int[] furniIds; - private int stuffTypeSelectionCode; - private int delay; - - public WiredSettings(int[] intParams, String stringParam, int[] furniIds, int stuffTypeSelectionCode, int delay) - { - this.furniIds = furniIds; - this.intParams = intParams; - this.stringParam = stringParam; - this.stuffTypeSelectionCode = stuffTypeSelectionCode; - this.delay = delay; - } - - public WiredSettings(int[] intParams, String stringParam, int[] furniIds, int stuffTypeSelectionCode) - { - this(intParams, stringParam, furniIds, stuffTypeSelectionCode, 0); - } - - public int getStuffTypeSelectionCode() { - return stuffTypeSelectionCode; - } - - public void setStuffTypeSelectionCode(int stuffTypeSelectionCode) { - this.stuffTypeSelectionCode = stuffTypeSelectionCode; - } - - public int[] getFurniIds() { - return furniIds; - } - - public void setFurniIds(int[] furniIds) { - this.furniIds = furniIds; - } - - public String getStringParam() { - return stringParam; - } - - public void setStringParam(String stringParam) { - this.stringParam = stringParam; - } - - public int[] getIntParams() { - return intParams; - } - - public void setIntParams(int[] intParams) { - this.intParams = intParams; - } - - public int getDelay() { - return delay; - } - - public void setDelay(int delay) { - this.delay = delay; - } -} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java index 11f1276f..d4b92964 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java @@ -3,13 +3,12 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredHandler; +import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.incoming.wired.WiredSaveException; import java.sql.ResultSet; import java.sql.SQLException; @@ -51,10 +50,10 @@ public class WiredConditionDateRangeActive extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 2) return false; - this.startDate = settings.getIntParams()[0]; - this.endDate = settings.getIntParams()[1]; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + this.startDate = packet.readInt(); + this.endDate = packet.readInt(); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java index 22ec093a..ddce19a5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -137,12 +136,15 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; + public boolean saveData(ClientMessage packet) { + int count; + packet.readInt(); - this.all = settings.getIntParams()[0] == 1; + this.all = packet.readInt() == 1; - int count = settings.getFurniIds().length; + packet.readString(); + + count = packet.readInt(); if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; this.items.clear(); @@ -151,7 +153,7 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition { if (room != null) { for (int i = 0; i < count; i++) { - HabboItem item = room.getHabboItem(settings.getFurniIds()[i]); + HabboItem item = room.getHabboItem(packet.readInt()); if (item != null) this.items.add(item); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java index 6a2a70a5..a0d07087 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java @@ -4,7 +4,6 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.pets.Pet; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; @@ -25,6 +24,8 @@ import java.util.stream.Collectors; public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition { public static final WiredConditionType type = WiredConditionType.FURNI_HAVE_HABBO; + + protected boolean all; protected THashSet items; public WiredConditionFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException { @@ -40,6 +41,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition { @Override public void onPickUp() { this.items.clear(); + this.all = false; } @Override @@ -65,6 +67,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition { public String getWiredData() { this.refresh(); return WiredHandler.getGsonBuilder().create().toJson(new JsonData( + this.all, this.items.stream().map(HabboItem::getId).collect(Collectors.toList()) )); } @@ -76,6 +79,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition { if (wiredData.startsWith("{")) { JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, JsonData.class); + this.all = data.all; for(int id : data.itemIds) { HabboItem item = room.getHabboItem(id); @@ -88,14 +92,17 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition { String[] data = wiredData.split(":"); if (data.length >= 1) { + this.all = (data[0].equals("1")); - String[] items = data[1].split(";"); + if (data.length == 2) { + String[] items = data[1].split(";"); - for (String s : items) { - HabboItem item = room.getHabboItem(Integer.parseInt(s)); + for (String s : items) { + HabboItem item = room.getHabboItem(Integer.parseInt(s)); - if (item != null) - this.items.add(item); + if (item != null) + this.items.add(item); + } } } } @@ -120,7 +127,8 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition { message.appendInt(this.getBaseItem().getSpriteId()); message.appendInt(this.getId()); message.appendString(""); - message.appendInt(0); + message.appendInt(1); + message.appendInt(this.all ? 1 : 0); message.appendInt(0); message.appendInt(this.getType().code); message.appendInt(0); @@ -128,9 +136,13 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - int count = settings.getFurniIds().length; + public boolean saveData(ClientMessage packet) { + int count; + packet.readInt(); + packet.readString(); + + count = packet.readInt(); if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; this.items.clear(); @@ -139,7 +151,7 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition { if (room != null) { for (int i = 0; i < count; i++) { - HabboItem item = room.getHabboItem(settings.getFurniIds()[i]); + HabboItem item = room.getHabboItem(packet.readInt()); if (item != null) this.items.add(item); @@ -170,9 +182,11 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition { } static class JsonData { + boolean all; List itemIds; - public JsonData(List itemIds) { + public JsonData(boolean all, List itemIds) { + this.all = all; this.itemIds = itemIds; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java index 9330457c..47c42d64 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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.HabboItem; @@ -118,8 +117,11 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - int count = settings.getFurniIds().length; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + packet.readString(); + + int count = packet.readInt(); if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; this.items.clear(); @@ -128,7 +130,7 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition { if (room != null) { for (int i = 0; i < count; i++) { - this.items.add(room.getHabboItem(settings.getFurniIds()[i])); + this.items.add(room.getHabboItem(packet.readInt())); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java index 5d4133d2..cc01ba75 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java @@ -2,7 +2,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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; @@ -70,7 +69,7 @@ public class WiredConditionGroupMember extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { + public boolean saveData(ClientMessage packet) { return true; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java index df8e2108..d5e93e21 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboCount.java @@ -2,7 +2,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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.wired.WiredConditionType; @@ -87,10 +86,11 @@ public class WiredConditionHabboCount extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 2) return false; - this.lowerLimit = settings.getIntParams()[0]; - this.upperLimit = settings.getIntParams()[1]; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.lowerLimit = packet.readInt(); + this.upperLimit = packet.readInt(); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java index 5f9f5b1a..7e1580f0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasEffect.java @@ -2,7 +2,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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.wired.WiredConditionType; @@ -77,9 +76,10 @@ public class WiredConditionHabboHasEffect extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; - this.effectId = settings.getIntParams()[0]; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.effectId = packet.readInt(); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java index d60ddede..0d351e98 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasHandItem.java @@ -2,7 +2,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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.wired.WiredConditionType; @@ -52,9 +51,10 @@ public class WiredConditionHabboHasHandItem extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; - this.handItem = settings.getIntParams()[0]; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.handItem = packet.readInt(); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java index 8d2b3dbe..b4f0df9f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboWearsBadge.java @@ -2,7 +2,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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; @@ -89,8 +88,10 @@ public class WiredConditionHabboWearsBadge extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - this.badge = settings.getStringParam(); + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.badge = packet.readString(); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java index f4db5bba..b40ee5e7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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.wired.WiredConditionType; @@ -82,9 +81,11 @@ public class WiredConditionLessTimeElapsed extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; - this.cycles = settings.getIntParams()[0]; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.cycles = packet.readInt(); + return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java index cd185dab..76ece81c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -70,24 +69,28 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 3) return false; - this.state = settings.getIntParams()[0] == 1; - this.direction = settings.getIntParams()[1] == 1; - this.position = settings.getIntParams()[2] == 1; + public boolean saveData(ClientMessage packet) { + int count; + packet.readInt(); + + this.state = packet.readInt() == 1; + this.direction = packet.readInt() == 1; + this.position = packet.readInt() == 1; + + packet.readString(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); if (room == null) return true; - int count = settings.getFurniIds().length; + count = packet.readInt(); if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; this.settings.clear(); for (int i = 0; i < count; i++) { - int itemId = settings.getFurniIds()[i]; + int itemId = packet.readInt(); HabboItem item = room.getHabboItem(itemId); if (item != null) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java index 83bd3004..0be6ba15 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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.wired.WiredConditionType; @@ -82,9 +81,11 @@ public class WiredConditionMoreTimeElapsed extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; - this.cycles = settings.getIntParams()[0]; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.cycles = packet.readInt(); + return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java index b09314c8..279f61bd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -138,11 +137,14 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; - this.all = settings.getIntParams()[0] == 1; + public boolean saveData(ClientMessage packet) { + packet.readInt(); - int count = settings.getFurniIds().length; + this.all = packet.readInt() == 1; + + packet.readString(); + + int count = packet.readInt(); if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; this.items.clear(); @@ -151,7 +153,7 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition { if (room != null) { for (int i = 0; i < count; i++) { - HabboItem item = room.getHabboItem(settings.getFurniIds()[i]); + HabboItem item = room.getHabboItem(packet.readInt()); if (item != null) this.items.add(item); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java index 9409ebe8..87f3bc9a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java @@ -4,7 +4,6 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.pets.Pet; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; @@ -25,7 +24,8 @@ import java.util.stream.Collectors; public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition { public static final WiredConditionType type = WiredConditionType.NOT_FURNI_HAVE_HABBO; - + + protected boolean all; protected THashSet items; public WiredConditionNotFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException { @@ -41,6 +41,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition { @Override public void onPickUp() { this.items.clear(); + this.all = false; } @Override @@ -66,6 +67,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition { public String getWiredData() { this.refresh(); return WiredHandler.getGsonBuilder().create().toJson(new JsonData( + this.all, this.items.stream().map(HabboItem::getId).collect(Collectors.toList()) )); } @@ -77,6 +79,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition { if (wiredData.startsWith("{")) { WiredConditionFurniHaveHabbo.JsonData data = WiredHandler.getGsonBuilder().create().fromJson(wiredData, WiredConditionFurniHaveHabbo.JsonData.class); + this.all = data.all; for(int id : data.itemIds) { HabboItem item = room.getHabboItem(id); @@ -89,13 +92,17 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition { String[] data = wiredData.split(":"); if (data.length >= 1) { - String[] items = data[1].split(";"); + this.all = (data[0].equals("1")); - for (String s : items) { - HabboItem item = room.getHabboItem(Integer.parseInt(s)); + if (data.length == 2) { + String[] items = data[1].split(";"); - if (item != null) - this.items.add(item); + for (String s : items) { + HabboItem item = room.getHabboItem(Integer.parseInt(s)); + + if (item != null) + this.items.add(item); + } } } } @@ -120,7 +127,8 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition { message.appendInt(this.getBaseItem().getSpriteId()); message.appendInt(this.getId()); message.appendString(""); - message.appendInt(0); + message.appendInt(1); + message.appendInt(this.all ? 1 : 0); message.appendInt(0); message.appendInt(this.getType().code); message.appendInt(0); @@ -128,8 +136,12 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - int count = settings.getFurniIds().length; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + packet.readString(); + + int count = packet.readInt(); if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; this.items.clear(); @@ -138,7 +150,7 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition { if (room != null) { for (int i = 0; i < count; i++) { - HabboItem item = room.getHabboItem(settings.getFurniIds()[i]); + HabboItem item = room.getHabboItem(packet.readInt()); if (item != null) this.items.add(item); @@ -169,9 +181,11 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition { } static class JsonData { + boolean all; List itemIds; - public JsonData(List itemIds) { + public JsonData(boolean all, List itemIds) { + this.all = all; this.itemIds = itemIds; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java index 595eee3e..30c9ea51 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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.HabboItem; @@ -118,8 +117,11 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - int count = settings.getFurniIds().length; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + packet.readString(); + + int count = packet.readInt(); if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; this.items.clear(); @@ -128,7 +130,7 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition { if (room != null) { for (int i = 0; i < count; i++) { - this.items.add(room.getHabboItem(settings.getFurniIds()[i])); + this.items.add(room.getHabboItem(packet.readInt())); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java index 7f1d6cab..3075c4ff 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboCount.java @@ -2,7 +2,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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.wired.WiredConditionType; @@ -86,10 +85,11 @@ public class WiredConditionNotHabboCount extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 2) return false; - this.lowerLimit = settings.getIntParams()[0]; - this.upperLimit = settings.getIntParams()[1]; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.lowerLimit = packet.readInt(); + this.upperLimit = packet.readInt(); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java index 3f1a733d..ae1c20bb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboHasEffect.java @@ -2,7 +2,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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.wired.WiredConditionType; @@ -77,9 +76,10 @@ public class WiredConditionNotHabboHasEffect extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; - this.effectId = settings.getIntParams()[0]; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.effectId = packet.readInt(); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java index cf84c109..6df96d6b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotHabboWearsBadge.java @@ -2,7 +2,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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; @@ -90,8 +89,10 @@ public class WiredConditionNotHabboWearsBadge extends InteractionWiredCondition } @Override - public boolean saveData(WiredSettings settings) { - this.badge = settings.getStringParam(); + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.badge = packet.readString(); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java index d7dbfbcb..520f28bf 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java @@ -2,7 +2,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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; @@ -70,7 +69,7 @@ public class WiredConditionNotInGroup extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { + public boolean saveData(ClientMessage packet) { return true; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java index 0f9d6c95..b805c7b1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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; @@ -90,9 +89,10 @@ public class WiredConditionNotInTeam extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; - this.teamColor = GameTeamColors.values()[settings.getIntParams()[0]]; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.teamColor = GameTeamColors.values()[packet.readInt()]; return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java index b8376c01..027db810 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -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; @@ -92,9 +91,10 @@ public class WiredConditionTeamMember extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; - this.teamColor = GameTeamColors.values()[settings.getIntParams()[0]]; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.teamColor = GameTeamColors.values()[packet.readInt()]; return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java index 0afdf18c..61e3fd70 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -119,8 +118,11 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition { } @Override - public boolean saveData(WiredSettings settings) { - int count = settings.getFurniIds().length; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + packet.readString(); + + int count = packet.readInt(); if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false; this.items.clear(); @@ -129,7 +131,7 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition { if (room != null) { for (int i = 0; i < count; i++) { - HabboItem item = room.getHabboItem(settings.getFurniIds()[i]); + HabboItem item = room.getHabboItem(packet.readInt()); if (item != null) { this.items.add(item); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java index 24a28885..f0a5b3f8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java @@ -5,13 +5,14 @@ import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -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.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; +import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.incoming.wired.WiredSaveException; +import com.google.gson.Gson; import java.sql.ResultSet; import java.sql.SQLException; @@ -48,9 +49,11 @@ public class WiredEffectBotClothes extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - String dataString = settings.getStringParam(); - int delay = settings.getDelay(); + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + String dataString = packet.readString(); + packet.readInt(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java index b46d0417..ee1b28b1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowHabbo.java @@ -6,12 +6,12 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; +import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.incoming.wired.WiredSaveException; import gnu.trove.procedure.TObjectProcedure; @@ -70,18 +70,17 @@ public class WiredEffectBotFollowHabbo extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - if(settings.getIntParams().length < 1) throw new WiredSaveException("Mode is invalid"); - - int mode = settings.getIntParams()[0]; + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + int mode = packet.readInt(); if(mode != 0 && mode != 1) throw new WiredSaveException("Mode is invalid"); - String botName = settings.getStringParam().replace("\t", ""); + String botName = packet.readString().replace("\t", ""); botName = botName.substring(0, Math.min(botName.length(), Emulator.getConfig().getInt("hotel.wired.message.max_length", 100))); - - int delay = settings.getDelay(); + packet.readInt(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java index 5b380d3c..27fc7888 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java @@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -14,6 +13,7 @@ import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; +import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem; @@ -74,17 +74,17 @@ public class WiredEffectBotGiveHandItem extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - if(settings.getIntParams().length < 1) throw new WiredSaveException("Missing item id"); + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); - int itemId = settings.getIntParams()[0]; + int itemId = packet.readInt(); if(itemId < 0) itemId = 0; - String botName = settings.getStringParam(); - - int delay = settings.getDelay(); + String botName = packet.readString(); + packet.readInt(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java index 79fae2ca..735b0f39 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java @@ -5,13 +5,13 @@ import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -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.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; +import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.incoming.wired.WiredSaveException; @@ -52,14 +52,15 @@ public class WiredEffectBotTalk extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - if(settings.getIntParams().length < 1) throw new WiredSaveException("Mode is invalid"); - int mode = settings.getIntParams()[0]; + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + + int mode = packet.readInt(); if(mode != 0 && mode != 1) throw new WiredSaveException("Mode is invalid"); - String dataString = settings.getStringParam(); + String dataString = packet.readString(); String splitBy = "\t"; if(!dataString.contains(splitBy)) @@ -70,7 +71,8 @@ public class WiredEffectBotTalk extends InteractionWiredEffect { if (data.length != 2) throw new WiredSaveException("Malformed data string. Invalid data length"); - int delay = settings.getDelay(); + packet.readInt(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java index ad0c8764..8fede69c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToHabbo.java @@ -6,13 +6,13 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; +import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.incoming.wired.WiredSaveException; import gnu.trove.procedure.TObjectProcedure; @@ -73,14 +73,15 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - if(settings.getIntParams().length < 1) throw new WiredSaveException("Missing mode"); - int mode = settings.getIntParams()[0]; + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + + int mode = packet.readInt(); if(mode != 0 && mode != 1) throw new WiredSaveException("Mode is invalid"); - String dataString = settings.getStringParam(); + String dataString = packet.readString(); String splitBy = "\t"; if(!dataString.contains(splitBy)) throw new WiredSaveException("Malformed data string"); @@ -90,7 +91,8 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect { if (data.length != 2) throw new WiredSaveException("Malformed data string. Invalid data length"); - int delay = settings.getDelay(); + packet.readInt(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java index 822934a6..07bbac6f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTileState; @@ -115,9 +114,10 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - String botName = settings.getStringParam(); - int itemsCount = settings.getFurniIds().length; + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + String botName = packet.readString(); + int itemsCount = packet.readInt(); if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { throw new WiredSaveException("Too many furni selected"); @@ -126,7 +126,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect { List newItems = new ArrayList<>(); for (int i = 0; i < itemsCount; i++) { - int itemId = settings.getFurniIds()[i]; + int itemId = packet.readInt(); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId); if(it == null) @@ -135,7 +135,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect { newItems.add(it); } - int delay = settings.getDelay(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java index b4b9d262..73906c87 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -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.HabboItem; @@ -68,9 +67,10 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - String botName = settings.getStringParam(); - int itemsCount = settings.getFurniIds().length; + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + String botName = packet.readString(); + int itemsCount = packet.readInt(); if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { throw new WiredSaveException("Too many furni selected"); @@ -79,7 +79,7 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect { List newItems = new ArrayList<>(); for (int i = 0; i < itemsCount; i++) { - int itemId = settings.getFurniIds()[i]; + int itemId = packet.readInt(); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId); if(it == null) @@ -88,7 +88,7 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect { newItems.add(it); } - int delay = settings.getDelay(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java index 7ee3859c..0ce892d7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java @@ -4,7 +4,6 @@ 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.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.wired.*; @@ -211,10 +210,9 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - if(settings.getIntParams().length < 2) throw new WiredSaveException("Invalid data"); - - int startDirectionInt = settings.getIntParams()[0]; + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + int startDirectionInt = packet.readInt(); if(startDirectionInt < 0 || startDirectionInt > 7 || (startDirectionInt % 2) != 0) { throw new WiredSaveException("Start direction is invalid"); @@ -222,13 +220,15 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect { RoomUserRotation startDirection = RoomUserRotation.fromValue(startDirectionInt); - int blockedActionInt = settings.getIntParams()[1]; + int blockedActionInt = packet.readInt(); if(blockedActionInt < 0 || blockedActionInt > 6) { throw new WiredSaveException("Blocked action is invalid"); } - int itemsCount = settings.getFurniIds().length; + packet.readString(); + + int itemsCount = packet.readInt(); if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { throw new WiredSaveException("Too many furni selected"); @@ -237,7 +237,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect { THashMap newItems = new THashMap<>(); for (int i = 0; i < itemsCount; i++) { - int itemId = settings.getFurniIds()[i]; + int itemId = packet.readInt(); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId); if(it == null) @@ -246,7 +246,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect { newItems.put(it, new WiredChangeDirectionSetting(it.getId(), it.getRotation(), startDirection)); } - int delay = settings.getDelay(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java index 70911e39..63920ffc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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; @@ -68,14 +67,17 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) { + public boolean saveData(ClientMessage packet, GameClient gameClient) { + packet.readInt(); + try { - this.amount = Integer.parseInt(settings.getStringParam()); + this.amount = Integer.parseInt(packet.readString()); } catch (Exception e) { return false; } - this.setDelay(settings.getDelay()); + packet.readInt(); + this.setDelay(packet.readInt()); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java index d228c75e..0bd62164 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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; @@ -67,14 +66,16 @@ public class WiredEffectGiveHotelviewHofPoints extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) { + public boolean saveData(ClientMessage packet, GameClient gameClient) { + packet.readInt(); + try { - this.amount = Integer.parseInt(settings.getStringParam()); + this.amount = Integer.valueOf(packet.readString()); } catch (Exception e) { return false; } - - this.setDelay(settings.getDelay()); + packet.readInt(); + this.setDelay(packet.readInt()); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java index 91b78467..4a3b966f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java @@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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; @@ -68,14 +67,17 @@ public class WiredEffectGiveRespect extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) { + public boolean saveData(ClientMessage packet, GameClient gameClient) { + packet.readInt(); + try { - this.respects = Integer.parseInt(settings.getStringParam()); + this.respects = Integer.valueOf(packet.readString()); } catch (Exception e) { return false; } - this.setDelay(settings.getDelay()); + packet.readInt(); + this.setDelay(packet.readInt()); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java index 3c8fb88b..f4c3a2ba 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.habbohotel.rooms.RoomChatMessageBubbles; @@ -16,7 +15,6 @@ import com.eu.habbo.habbohotel.wired.WiredGiveRewardItem; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer; import gnu.trove.procedure.TObjectProcedure; import gnu.trove.set.hash.THashSet; @@ -176,16 +174,16 @@ public class WiredEffectGiveReward extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { + public boolean saveData(ClientMessage packet, GameClient gameClient) { if (gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) { - if(settings.getIntParams().length < 4) throw new WiredSaveException("Invalid data"); - this.rewardTime = settings.getIntParams()[0]; - this.uniqueRewards = settings.getIntParams()[1] == 1; - this.limit = settings.getIntParams()[2]; - this.limitationInterval = settings.getIntParams()[3]; + int argsLength = packet.readInt(); + this.rewardTime = packet.readInt(); + this.uniqueRewards = packet.readInt() == 1; + this.limit = packet.readInt(); + this.limitationInterval = packet.readInt(); this.given = 0; - String data = settings.getStringParam(); + String data = packet.readString(); String[] items = data.split(";"); @@ -206,7 +204,8 @@ public class WiredEffectGiveReward extends InteractionWiredEffect { return false; } - this.setDelay(settings.getDelay()); + packet.readInt(); + this.setDelay(packet.readInt()); WiredHandler.dropRewards(this.getId()); return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java index 293515cc..6632c2e4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java @@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.games.Game; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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; @@ -173,20 +172,23 @@ public class WiredEffectGiveScore extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - if(settings.getIntParams().length < 2) throw new WiredSaveException("Invalid data"); + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); - int score = settings.getIntParams()[0]; + int score = packet.readInt(); if(score < 1 || score > 100) throw new WiredSaveException("Score is invalid"); - int timesPerGame = settings.getIntParams()[1]; + int timesPerGame = packet.readInt(); if(timesPerGame < 1 || timesPerGame > 10) throw new WiredSaveException("Times per game is invalid"); - int delay = settings.getDelay(); + packet.readString(); + packet.readInt(); + + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java index a439a668..dcbc1481 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java @@ -8,7 +8,6 @@ import com.eu.habbo.habbohotel.games.GameTeam; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -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.wired.WiredEffectType; @@ -122,25 +121,28 @@ public class WiredEffectGiveScoreToTeam extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - if(settings.getIntParams().length < 3) throw new WiredSaveException("Invalid data"); + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); - int points = settings.getIntParams()[0]; + int points = packet.readInt(); if(points < 1 || points > 100) throw new WiredSaveException("Points is invalid"); - int timesPerGame = settings.getIntParams()[1]; + int timesPerGame = packet.readInt(); if(timesPerGame < 1 || timesPerGame > 10) throw new WiredSaveException("Times per game is invalid"); - int team = settings.getIntParams()[2]; + int team = packet.readInt(); if(team < 1 || team > 4) throw new WiredSaveException("Team is invalid"); - int delay = settings.getDelay(); + packet.readString(); + packet.readInt(); + + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java index 28bd7c49..8d367009 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java @@ -8,7 +8,6 @@ import com.eu.habbo.habbohotel.games.wired.WiredGame; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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; @@ -135,15 +134,16 @@ public class WiredEffectJoinTeam extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - if(settings.getIntParams().length < 1) throw new WiredSaveException("invalid data"); - - int team = settings.getIntParams()[0]; + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + int team = packet.readInt(); if(team < 1 || team > 4) throw new WiredSaveException("Team is invalid"); - int delay = settings.getDelay(); + packet.readInt(); + packet.readString(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java index a75f2e3e..e0f2ecd2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickHabbo.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.habbohotel.rooms.RoomChatMessage; @@ -149,9 +148,11 @@ public class WiredEffectKickHabbo extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - String message = settings.getStringParam(); - int delay = settings.getDelay(); + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + String message = packet.readString(); + packet.readInt(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java index 74830cfa..deff061e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java @@ -7,7 +7,6 @@ import com.eu.habbo.habbohotel.games.wired.WiredGame; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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; @@ -117,8 +116,11 @@ public class WiredEffectLeaveTeam extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - int delay = settings.getDelay(); + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + packet.readString(); + packet.readInt(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java index 8d74e312..bb615d8d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java @@ -4,7 +4,6 @@ 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.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings; import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.users.HabboItem; @@ -176,18 +175,21 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - if(settings.getIntParams().length < 3) throw new WiredSaveException("Invalid data"); - boolean setState = settings.getIntParams()[0] == 1; - boolean setDirection = settings.getIntParams()[1] == 1; - boolean setPosition = settings.getIntParams()[2] == 1; + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + + boolean setState = packet.readInt() == 1; + boolean setDirection = packet.readInt() == 1; + boolean setPosition = packet.readInt() == 1; + + packet.readString(); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); if (room == null) throw new WiredSaveException("Trying to save wired in unloaded room"); - int itemsCount = settings.getFurniIds().length; + int itemsCount = packet.readInt(); if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { throw new WiredSaveException("Too many furni selected"); @@ -196,7 +198,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int List newSettings = new ArrayList<>(); for (int i = 0; i < itemsCount; i++) { - int itemId = settings.getFurniIds()[i]; + int itemId = packet.readInt(); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId); if(it == null) @@ -205,7 +207,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int newSettings.add(new WiredMatchFurniSetting(it.getId(), this.checkForWiredResetPermission && it.allowWiredResetState() ? it.getExtradata() : " ", it.getRotation(), it.getX(), it.getY())); } - int delay = settings.getDelay(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java index 9f016a9e..76fe1ed9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java @@ -4,7 +4,6 @@ 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.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; @@ -179,8 +178,10 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - int itemsCount = settings.getFurniIds().length; + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + packet.readString(); + int itemsCount = packet.readInt(); if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { throw new WiredSaveException("Too many furni selected"); @@ -189,7 +190,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect { List newItems = new ArrayList<>(); for (int i = 0; i < itemsCount; i++) { - int itemId = settings.getFurniIds()[i]; + int itemId = packet.readInt(); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId); if(it == null) @@ -198,7 +199,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect { newItems.add(it); } - int delay = settings.getDelay(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java index 4118fd05..3b9367e2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java @@ -4,7 +4,6 @@ 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.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -13,7 +12,6 @@ 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.ServerMessage; -import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; import gnu.trove.set.hash.THashSet; @@ -41,7 +39,7 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { + public boolean saveData(ClientMessage packet, GameClient gameClient) { Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); if (room == null) @@ -50,16 +48,18 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect { this.items.clear(); this.indexOffset.clear(); - if(settings.getIntParams().length < 2) throw new WiredSaveException("invalid data"); - this.direction = settings.getIntParams()[0]; - this.spacing = settings.getIntParams()[1]; + packet.readInt(); - int count = settings.getFurniIds().length; + this.direction = packet.readInt(); + this.spacing = packet.readInt(); + packet.readString(); + + int count = packet.readInt(); for (int i = 0; i < count; i++) { - this.items.add(room.getHabboItem(settings.getFurniIds()[i])); + this.items.add(room.getHabboItem(packet.readInt())); } - this.setDelay(settings.getDelay()); + this.setDelay(packet.readInt()); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java index 89f56d3d..c069dc93 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java @@ -4,7 +4,6 @@ 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.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; @@ -315,8 +314,11 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - int itemsCount = settings.getFurniIds().length; + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + packet.readString(); + + int itemsCount = packet.readInt(); if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { throw new WiredSaveException("Too many furni selected"); @@ -325,7 +327,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect { List newItems = new ArrayList<>(); for (int i = 0; i < itemsCount; i++) { - int itemId = settings.getFurniIds()[i]; + int itemId = packet.readInt(); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId); if(it == null) @@ -334,7 +336,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect { newItems.add(it); } - int delay = settings.getDelay(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); 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 fd24af08..5928e671 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 @@ -5,14 +5,12 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.ICycleable; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.users.HabboItem; 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.ServerMessage; -import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; import gnu.trove.set.hash.THashSet; import org.slf4j.Logger; @@ -187,26 +185,28 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { + public boolean saveData(ClientMessage packet, GameClient gameClient) { Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); if (room == null) return false; - if(settings.getIntParams().length < 2) throw new WiredSaveException("invalid data"); + packet.readInt(); - this.direction = settings.getIntParams()[0]; - this.rotation = settings.getIntParams()[1]; + this.direction = packet.readInt(); + this.rotation = packet.readInt(); - int count = settings.getFurniIds().length; + packet.readString(); + + int count = packet.readInt(); if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count", 5)) return false; this.items.clear(); for (int i = 0; i < count; i++) { - this.items.add(room.getHabboItem(settings.getFurniIds()[i])); + this.items.add(room.getHabboItem(packet.readInt())); } - this.setDelay(settings.getDelay()); + this.setDelay(packet.readInt()); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java index ed3639a8..39788018 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteHabbo.java @@ -4,7 +4,6 @@ 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.InteractionWiredEffect; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; @@ -14,7 +13,6 @@ 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.ServerMessage; -import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer; import java.sql.ResultSet; @@ -51,13 +49,12 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - if(settings.getIntParams().length < 1) throw new WiredSaveException("invalid data"); - - this.length = settings.getIntParams()[0]; - this.message = settings.getStringParam(); - - this.setDelay(settings.getDelay()); + public boolean saveData(ClientMessage packet, GameClient gameClient) { + packet.readInt(); + this.length = packet.readInt(); + this.message = packet.readString(); + packet.readInt(); + this.setDelay(packet.readInt()); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java index 826b8d31..583e4f6a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.wired.WiredEffectType; @@ -68,8 +67,13 @@ public class WiredEffectResetTimers extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) { - this.setDelay(settings.getDelay()); + public boolean saveData(ClientMessage packet, GameClient gameClient) { + packet.readInt(); + packet.readString(); + packet.readInt(); + this.delay = packet.readInt(); + this.setDelay(this.delay); + return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java index cf6197ad..304703f1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTileState; @@ -131,8 +130,11 @@ public class WiredEffectTeleport extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - int itemsCount = settings.getFurniIds().length; + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + packet.readString(); + + int itemsCount = packet.readInt(); if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { throw new WiredSaveException("Too many furni selected"); @@ -141,7 +143,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect { List newItems = new ArrayList<>(); for (int i = 0; i < itemsCount; i++) { - int itemId = settings.getFurniIds()[i]; + int itemId = packet.readInt(); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId); if(it == null) @@ -150,7 +152,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect { newItems.add(it); } - int delay = settings.getDelay(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java index 7a3a0e16..05eef1f3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java @@ -17,7 +17,6 @@ import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreeze import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField; import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole; import com.eu.habbo.habbohotel.items.interactions.pets.*; -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; @@ -143,8 +142,11 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - int itemsCount = settings.getFurniIds().length; + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + packet.readString(); + + int itemsCount = packet.readInt(); if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { throw new WiredSaveException("Too many furni selected"); @@ -153,7 +155,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect { List newItems = new ArrayList<>(); for (int i = 0; i < itemsCount; i++) { - int itemId = settings.getFurniIds()[i]; + int itemId = packet.readInt(); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId); if(it == null) @@ -162,7 +164,7 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect { newItems.add(it); } - int delay = settings.getDelay(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java index d5e60925..4fbd9203 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java @@ -15,7 +15,6 @@ import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreeze import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField; import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole; import com.eu.habbo.habbohotel.items.interactions.pets.*; -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.HabboItem; @@ -138,8 +137,11 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - int itemsCount = settings.getFurniIds().length; + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + packet.readString(); + + int itemsCount = packet.readInt(); if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { throw new WiredSaveException("Too many furni selected"); @@ -148,7 +150,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect { List newItems = new ArrayList<>(); for (int i = 0; i < itemsCount; i++) { - int itemId = settings.getFurniIds()[i]; + int itemId = packet.readInt(); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId); if(it == null) @@ -157,7 +159,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect { newItems.add(it); } - int delay = settings.getDelay(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java index 4f50f57f..db37872b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -86,8 +85,11 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - int itemsCount = settings.getFurniIds().length; + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + packet.readString(); + + int itemsCount = packet.readInt(); if(itemsCount > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) { throw new WiredSaveException("Too many furni selected"); @@ -96,7 +98,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect { List newItems = new ArrayList<>(); for (int i = 0; i < itemsCount; i++) { - int itemId = settings.getFurniIds()[i]; + int itemId = packet.readInt(); HabboItem it = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(itemId); if(it == null) @@ -105,7 +107,7 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect { newItems.add(it); } - int delay = settings.getDelay(); + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java index 79a7ba53..56d6f35e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java @@ -5,13 +5,14 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.*; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.wired.WiredChangeDirectionSetting; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; +import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.incoming.wired.WiredSaveException; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer; @@ -69,15 +70,19 @@ public class WiredEffectWhisper extends InteractionWiredEffect { } @Override - public boolean saveData(WiredSettings settings, GameClient gameClient) throws WiredSaveException { - String message = settings.getStringParam(); + public boolean saveData(ClientMessage packet, GameClient gameClient) throws WiredSaveException { + packet.readInt(); + + String message = packet.readString(); if(gameClient.getHabbo() == null || !gameClient.getHabbo().hasPermission(Permission.ACC_SUPERWIRED)) { message = Emulator.getGameEnvironment().getWordFilter().filter(message, null); message = message.substring(0, Math.min(message.length(), Emulator.getConfig().getInt("hotel.wired.message.max_length", 100))); } - int delay = settings.getDelay(); + packet.readInt(); + + int delay = packet.readInt(); if(delay > Emulator.getConfig().getInt("hotel.wired.max_delay", 20)) throw new WiredSaveException("Delay too long"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java index 60756729..f6364641 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java @@ -4,7 +4,6 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -111,9 +110,9 @@ public class WiredTriggerAtSetTime extends InteractionWiredTrigger implements Wi } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; - this.executeTime = settings.getIntParams()[0] * 500; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + this.executeTime = packet.readInt() * 500; this.resetTimer(); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java index 7fdf0a2a..751d21c7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java @@ -4,7 +4,6 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -110,9 +109,10 @@ public class WiredTriggerAtTimeLong extends InteractionWiredTrigger implements W } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; - this.executeTime = settings.getIntParams()[0] * 500; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.executeTime = packet.readInt() * 500; return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java index 3de2e345..596fbc8f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.HabboItem; @@ -98,15 +97,17 @@ public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger { } @Override - public boolean saveData(WiredSettings settings) { - this.botName = settings.getStringParam(); + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.botName = packet.readString(); this.items.clear(); - int count = settings.getFurniIds().length; + int count = packet.readInt(); for (int i = 0; i < count; i++) { - this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i])); + this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt())); } return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java index 0023fb6d..0e7b22fd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedHabbo.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers; import com.eu.habbo.habbohotel.bots.Bot; 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.wired.WiredHandler; @@ -49,8 +48,10 @@ public class WiredTriggerBotReachedHabbo extends InteractionWiredTrigger { } @Override - public boolean saveData(WiredSettings settings) { - this.botName = settings.getStringParam(); + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.botName = packet.readString(); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java index a40bf2e1..4e446609 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java @@ -2,7 +2,6 @@ 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.HabboItem; @@ -66,7 +65,7 @@ public class WiredTriggerCollision extends InteractionWiredTrigger { } @Override - public boolean saveData(WiredSettings settings) { + public boolean saveData(ClientMessage packet) { return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java index 5d315e52..f97f332f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers; import com.eu.habbo.Emulator; 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; @@ -136,13 +135,16 @@ public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger { } @Override - public boolean saveData(WiredSettings settings) { + public boolean saveData(ClientMessage packet) { + packet.readInt(); + packet.readString(); + this.items.clear(); - int count = settings.getFurniIds().length; + int count = packet.readInt(); for (int i = 0; i < count; i++) { - this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i])); + this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt())); } return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java index 55ff097c..abb84177 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.wired.WiredTriggerType; @@ -84,7 +83,7 @@ public class WiredTriggerGameEnds extends InteractionWiredTrigger { } @Override - public boolean saveData(WiredSettings settings) { + public boolean saveData(ClientMessage packet) { return true; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java index 89c9a657..5631cb46 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; 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.wired.WiredTriggerType; @@ -84,7 +83,7 @@ public class WiredTriggerGameStarts extends InteractionWiredTrigger { } @Override - public boolean saveData(WiredSettings settings) { + public boolean saveData(ClientMessage packet) { return true; } } 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 d93a1ba1..9a1400b2 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,7 +2,6 @@ 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; @@ -86,8 +85,9 @@ public class WiredTriggerHabboEntersRoom extends InteractionWiredTrigger { } @Override - public boolean saveData(WiredSettings settings) { - this.username = settings.getStringParam(); + public boolean saveData(ClientMessage packet) { + packet.readInt(); + this.username = packet.readString(); return true; } 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 d0bdd637..f3b90ae3 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 @@ -2,7 +2,6 @@ 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; @@ -94,10 +93,10 @@ public class WiredTriggerHabboSaysKeyword extends InteractionWiredTrigger { } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; - this.ownerOnly = settings.getIntParams()[0] == 1; - this.key = settings.getStringParam(); + public boolean saveData(ClientMessage packet) { + packet.readInt(); + this.ownerOnly = packet.readInt() == 1; + this.key = packet.readString(); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java index 10b458b9..64e9dae9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers; import com.eu.habbo.Emulator; 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.HabboItem; @@ -129,13 +128,16 @@ public class WiredTriggerHabboWalkOffFurni extends InteractionWiredTrigger { } @Override - public boolean saveData(WiredSettings settings) { + public boolean saveData(ClientMessage packet) { + packet.readInt(); + packet.readString(); + this.items.clear(); - int count = settings.getFurniIds().length; + int count = packet.readInt(); for (int i = 0; i < count; i++) { - this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i])); + this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt())); } return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java index d24be482..257f23bb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java @@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers; import com.eu.habbo.Emulator; 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.HabboItem; @@ -83,13 +82,16 @@ public class WiredTriggerHabboWalkOnFurni extends InteractionWiredTrigger { } @Override - public boolean saveData(WiredSettings settings) { + public boolean saveData(ClientMessage packet) { + packet.readInt(); + packet.readString(); + this.items.clear(); - int count = settings.getFurniIds().length; + int count = packet.readInt(); for (int i = 0; i < count; i++) { - this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(settings.getFurniIds()[i])); + this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt())); } return true; 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 f43ffac0..36d48b3e 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 @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.items.ICycleable; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -110,9 +109,10 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements ICy } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; - this.repeatTime = settings.getIntParams()[0] * 500; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.repeatTime = packet.readInt() * 500; this.counter = 0; if (this.repeatTime < 500) { 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 536aca86..ad93a09d 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 @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.items.ICycleable; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; -import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -108,9 +107,10 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; - this.repeatTime = settings.getIntParams()[0] * 5000; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + + this.repeatTime = packet.readInt() * 5000; this.counter = 0; return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java index 463e5ba7..1f558d88 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java @@ -2,7 +2,6 @@ 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.wired.WiredHandler; @@ -86,9 +85,9 @@ public class WiredTriggerScoreAchieved extends InteractionWiredTrigger { } @Override - public boolean saveData(WiredSettings settings) { - if(settings.getIntParams().length < 1) return false; - this.score = settings.getIntParams()[0]; + public boolean saveData(ClientMessage packet) { + packet.readInt(); + this.score = packet.readInt(); return true; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredConditionSaveDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredConditionSaveDataEvent.java index a7443e82..93972ee1 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredConditionSaveDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredConditionSaveDataEvent.java @@ -1,13 +1,10 @@ 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; -import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer; import com.eu.habbo.messages.outgoing.wired.WiredSavedComposer; public class WiredConditionSaveDataEvent extends MessageHandler { @@ -22,16 +19,12 @@ public class WiredConditionSaveDataEvent extends MessageHandler { InteractionWiredCondition condition = room.getRoomSpecialTypes().getCondition(itemId); if (condition != null) { - WiredSettings settings = InteractionWired.readSettings(this.packet, false); - - if (condition.saveData(settings)) { + if (condition.saveData(this.packet)) { this.client.sendResponse(new WiredSavedComposer()); condition.needsUpdate(true); Emulator.getThreading().run(condition); - } else { - this.client.sendResponse(new UpdateFailedComposer("There was an error while saving that condition")); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredEffectSaveDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredEffectSaveDataEvent.java index 41de3dd9..fbf51226 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredEffectSaveDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredEffectSaveDataEvent.java @@ -1,12 +1,11 @@ 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; +import com.eu.habbo.messages.outgoing.generic.alerts.GenericErrorMessagesComposer; import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer; import com.eu.habbo.messages.outgoing.wired.WiredSavedComposer; @@ -25,8 +24,7 @@ public class WiredEffectSaveDataEvent extends MessageHandler { if (effect == null) throw new WiredSaveException(String.format("Wired effect with item id %s not found in room", itemId)); - WiredSettings settings = InteractionWired.readSettings(this.packet, true); - if (effect.saveData(settings, this.client)) { + if (effect.saveData(this.packet, this.client)) { this.client.sendResponse(new WiredSavedComposer()); effect.needsUpdate(true); Emulator.getThreading().run(effect); diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredTriggerSaveDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredTriggerSaveDataEvent.java index 5b3b25e5..8f62f60e 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/wired/WiredTriggerSaveDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/wired/WiredTriggerSaveDataEvent.java @@ -1,13 +1,10 @@ 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; -import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer; import com.eu.habbo.messages.outgoing.wired.WiredSavedComposer; public class WiredTriggerSaveDataEvent extends MessageHandler { @@ -22,16 +19,12 @@ public class WiredTriggerSaveDataEvent extends MessageHandler { InteractionWiredTrigger trigger = room.getRoomSpecialTypes().getTrigger(itemId); if (trigger != null) { - WiredSettings settings = InteractionWired.readSettings(this.packet, false); - - if (trigger.saveData(settings)) { + if (trigger.saveData(this.packet)) { this.client.sendResponse(new WiredSavedComposer()); trigger.needsUpdate(true); Emulator.getThreading().run(trigger); - } else { - this.client.sendResponse(new UpdateFailedComposer("There was an error while saving that trigger")); } } }