diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SummonCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/SummonCommand.java index 727d3fe2..3bb7ae87 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SummonCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/SummonCommand.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; +import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.users.Habbo; @@ -36,22 +37,21 @@ public class SummonCommand extends Command { return true; } - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.generic.cmd_summon.summoning").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT); + Room room = habbo.getHabboInfo().getCurrentRoom(); + if (room != null) { + Emulator.getGameEnvironment().getRoomManager().logExit(habbo); - Emulator.getGameEnvironment().getRoomManager().leaveRoom(habbo, habbo.getHabboInfo().getCurrentRoom()); + room.removeHabbo(habbo, true); + + habbo.getHabboInfo().setCurrentRoom(null); + } + + Emulator.getGameEnvironment().getRoomManager().enterRoom(habbo, gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), "", true); habbo.getClient().sendResponse(new ForwardToRoomComposer(gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId())); - Emulator.getGameEnvironment().getRoomManager().enterRoom(habbo, gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), "", true); - habbo.getClient().sendResponse(new HideDoorbellComposer("")); gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_summon.summoned").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT); - RoomTile t = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(gameClient.getHabbo().getRoomUnit().getCurrentLocation(), gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue()); - - if (t != null && gameClient.getHabbo().getHabboInfo().getCurrentRoom().tileWalkable(t)) { - habbo.getRoomUnit().setGoalLocation(t); - } - habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_summon.been_summoned").replace("%user%", gameClient.getHabbo().getHabboInfo().getUsername())); return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/SummonRankCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/SummonRankCommand.java index 8dd8a070..d2c1252c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/SummonRankCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/SummonRankCommand.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.commands; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; +import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer; @@ -33,9 +34,19 @@ public class SummonRankCommand extends Command { if (set.getValue().getHabboInfo().getCurrentRoom() == gameClient.getHabbo().getHabboInfo().getCurrentRoom()) continue; - Emulator.getGameEnvironment().getRoomManager().leaveRoom(set.getValue(), set.getValue().getHabboInfo().getCurrentRoom()); - set.getValue().getClient().sendResponse(new ForwardToRoomComposer(gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId())); + Room room = set.getValue().getHabboInfo().getCurrentRoom(); + if (room != null) { + Emulator.getGameEnvironment().getRoomManager().logExit(set.getValue()); + + room.removeHabbo(set.getValue(), true); + + set.getValue().getHabboInfo().setCurrentRoom(null); + } + Emulator.getGameEnvironment().getRoomManager().enterRoom(set.getValue(), gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), "", true); + + set.getValue().getClient().sendResponse(new ForwardToRoomComposer(gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId())); + } } }