diff --git a/sqlupdates/2_0_0-RC-2_TO_2_0_0-RC-3.sql b/sqlupdates/2_0_0-RC-2_TO_2_0_0-RC-3.sql index 6769fd62..693b0804 100644 --- a/sqlupdates/2_0_0-RC-2_TO_2_0_0-RC-3.sql +++ b/sqlupdates/2_0_0-RC-2_TO_2_0_0-RC-3.sql @@ -11,4 +11,6 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('scripter.modtool.ticket INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('invisible.prevent.chat', '0'); INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('invisible.prevent.chat.error', 'While being invisible you cannot talk.'); +INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('commands.succes.cmd_invisible.updated.back', 'You are now visible again.'); + #END DATABASE UPDATE: 2.0.0 RC-2 -> 2.0.0 RC-3 \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java index 464f33b3..8be82b99 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/InvisibleCommand.java @@ -2,8 +2,14 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; +import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomUnit; +import com.eu.habbo.habbohotel.rooms.RoomUserRotation; +import com.eu.habbo.habbohotel.wired.WiredHandler; +import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserRemoveComposer; +import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; +import com.eu.habbo.messages.outgoing.rooms.users.RoomUsersComposer; public class InvisibleCommand extends Command { @@ -17,10 +23,30 @@ public class InvisibleCommand extends Command { RoomUnit roomUnit = gameClient.getHabbo().getRoomUnit(); + if (roomUnit.isInvisible()) { + RoomLayout roomLayout = roomUnit.getRoom().getLayout(); + + roomUnit.setLocation(roomLayout.getDoorTile()); + roomUnit.clearStatus(); + roomUnit.clearWalking(); + roomUnit.setBodyRotation(RoomUserRotation.values()[roomLayout.getDoorDirection()]); + roomUnit.setHeadRotation(RoomUserRotation.values()[roomLayout.getDoorDirection()]); + roomUnit.setInvisible(false); + roomUnit.setInRoom(true); + + roomUnit.getRoom().sendComposer(new RoomUsersComposer(gameClient.getHabbo()).compose()); + roomUnit.getRoom().sendComposer(new RoomUserStatusComposer(roomUnit).compose()); + + WiredHandler.handle(WiredTriggerType.ENTER_ROOM, roomUnit, roomUnit.getRoom(), null); + roomUnit.getRoom().habboEntered(gameClient.getHabbo()); + + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_invisible.updated.back")); + + return true; + } + roomUnit.setInvisible(true); - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_invisible.updated")); - gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserRemoveComposer(roomUnit).compose()); return true;