From b0cac91fb6c565794f62637dc7082e6dc1b8b31a Mon Sep 17 00:00:00 2001 From: Beny Date: Sun, 5 May 2019 03:51:27 +0100 Subject: [PATCH] Various game fixes --- .../com/eu/habbo/habbohotel/games/Game.java | 50 +++++----- .../games/battlebanzai/BattleBanzaiGame.java | 18 +--- .../battlebanzai/BattleBanzaiGameTeam.java | 13 ++- .../habbohotel/games/freeze/FreezeGame.java | 54 ++++------- .../games/freeze/FreezeGameTeam.java | 13 ++- .../games/InteractionGameGate.java | 12 +++ .../games/InteractionGameTimer.java | 55 ++++++----- .../gates/InteractionBattleBanzaiGate.java | 13 +-- .../freeze/gates/InteractionFreezeGate.java | 11 +-- .../wired/effects/WiredEffectBotTalk.java | 3 - .../wired/effects/WiredEffectTeleport.java | 91 +++++++++---------- 11 files changed, 156 insertions(+), 177 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/games/Game.java b/src/main/java/com/eu/habbo/habbohotel/games/Game.java index d052d2d9..4e13453f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/Game.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/Game.java @@ -25,28 +25,19 @@ import java.util.Map; public abstract class Game implements Runnable { - public final Class gameTeamClazz; - - - public final Class gamePlayerClazz; + private final Class gameTeamClazz; + private final Class gamePlayerClazz; protected final THashMap teams = new THashMap<>(); - protected final Room room; + private final boolean countsAchievements; - protected final boolean countsAchievements; + private int startTime; - - protected int startTime; - - - protected int pauseTime; - - - protected int endTime; + private int endTime; public boolean isRunning; @@ -133,6 +124,7 @@ public abstract class Game implements Runnable } } + /* boolean deleteGame = true; for (GameTeam team : this.teams.values()) { @@ -147,6 +139,7 @@ public abstract class Game implements Runnable { this.room.deleteGame(this); } + */ } @@ -172,6 +165,8 @@ public abstract class Game implements Runnable } public void onEnd() { + this.endTime = Emulator.getIntUnixTimestamp(); + this.saveScores(); GameTeam winningTeam = null; @@ -214,7 +209,6 @@ public abstract class Game implements Runnable if (this.state.equals(GameState.RUNNING)) { this.state = GameState.PAUSED; - this.pauseTime = Emulator.getIntUnixTimestamp(); } } @@ -223,14 +217,12 @@ public abstract class Game implements Runnable if (this.state.equals(GameState.PAUSED)) { this.state = GameState.RUNNING; - this.endTime = Emulator.getIntUnixTimestamp() + (this.endTime - this.pauseTime); } } public void stop() { this.state = GameState.IDLE; - this.endTime = Emulator.getIntUnixTimestamp(); boolean gamesActive = false; for(HabboItem timer : room.getFloorItems()) @@ -302,27 +294,33 @@ public abstract class Game implements Runnable } } - public Room getRoom() { return this.room; } - public int getStartTime() { return this.startTime; } - - public int getEndTime() - { - return this.endTime; + public Class getGameTeamClass() { + return gameTeamClazz; } + public Class getGamePlayerClass() { + return gamePlayerClazz; + } - public void addTime(int time) - { - this.endTime += time; + public THashMap getTeams() { + return teams; + } + + public boolean isCountsAchievements() { + return countsAchievements; + } + + public GameState getState() { + return state; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java index 224dc623..f61002ff 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java @@ -175,7 +175,7 @@ public class BattleBanzaiGame extends Game timer.setRunning(false); } - InteractionGameTimer.endGames(room); + InteractionGameTimer.endGames(room, true); } } catch (Exception e) @@ -267,22 +267,6 @@ public class BattleBanzaiGame extends Game } } - public void addPositionToGate(GameTeamColors teamColor) - { - for (InteractionBattleBanzaiGate gate : this.room.getRoomSpecialTypes().getBattleBanzaiGates().values()) - { - if (gate.teamColor != teamColor) - continue; - - if (gate.getExtradata().isEmpty() || gate.getExtradata().equals("0")) - continue; - - gate.setExtradata(Integer.valueOf(gate.getExtradata()) - 1 + ""); - this.room.updateItemState(gate); - break; - } - } - public void tileLocked(GameTeamColors teamColor, HabboItem item, Habbo habbo) { diff --git a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGameTeam.java b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGameTeam.java index 55e7f3f2..9894169d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGameTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGameTeam.java @@ -4,6 +4,8 @@ import com.eu.habbo.habbohotel.games.Game; import com.eu.habbo.habbohotel.games.GamePlayer; import com.eu.habbo.habbohotel.games.GameTeam; import com.eu.habbo.habbohotel.games.GameTeamColors; +import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate; +import com.eu.habbo.habbohotel.rooms.Room; public class BattleBanzaiGameTeam extends GameTeam { @@ -24,14 +26,17 @@ public class BattleBanzaiGameTeam extends GameTeam public void removeMember(GamePlayer gamePlayer) { Game game = gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().getGame(gamePlayer.getHabbo().getHabboInfo().getCurrentGame()); - if(game instanceof BattleBanzaiGame) - { - ((BattleBanzaiGame) game).addPositionToGate(gamePlayer.getTeamColor()); - } + Room room = gamePlayer.getHabbo().getRoomUnit().getRoom(); gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gamePlayer.getHabbo(), 0, -1); gamePlayer.getHabbo().getRoomUnit().setCanWalk(true); super.removeMember(gamePlayer); + + if(room != null && room.getRoomSpecialTypes() != null) { + for (InteractionGameGate gate : room.getRoomSpecialTypes().getBattleBanzaiGates().values()) { + gate.updateState(game, 5); + } + } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java index fb2ba5d8..616242a2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreeze import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeTimer; import com.eu.habbo.habbohotel.items.interactions.games.freeze.gates.InteractionFreezeGate; import com.eu.habbo.habbohotel.items.interactions.games.freeze.scoreboards.InteractionFreezeScoreboard; +import com.eu.habbo.habbohotel.items.interactions.wired.effects.WiredEffectTeleport; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomTile; @@ -64,23 +65,6 @@ public class FreezeGame extends Game t.initialise(); } - if (this.room.getRoomSpecialTypes().hasFreezeExitTile()) - { - for (Habbo habbo : this.room.getHabbos()) - { - if (this.getTeamForHabbo(habbo) == null) - { - for (HabboItem item : this.room.getItemsAt(habbo.getRoomUnit().getCurrentLocation())) - { - if (item instanceof InteractionFreezeTile) - { - this.room.teleportHabboToItem(habbo, this.room.getRoomSpecialTypes().getRandomFreezeExitTile()); - } - } - } - } - } - this.start(); } @@ -96,22 +80,6 @@ public class FreezeGame extends Game } } - public synchronized void placebackHelmet(GameTeamColors teamColor) - { - for (InteractionFreezeGate gate : this.room.getRoomSpecialTypes().getFreezeGates().values()) - { - if (gate.teamColor != teamColor) - continue; - - if (gate.getExtradata().isEmpty() || gate.getExtradata().equals("0")) - continue; - - gate.setExtradata(Integer.valueOf(gate.getExtradata()) - 1 + ""); - this.room.updateItemState(gate); - break; - } - } - public void throwBall(Habbo habbo, InteractionFreezeTile item) { if (!this.state.equals(GameState.RUNNING) || !habbo.getHabboInfo().isInGame() || habbo.getHabboInfo().getCurrentGame() != this.getClass()) @@ -259,8 +227,26 @@ public class FreezeGame extends Game super.start(); + if (this.room.getRoomSpecialTypes().hasFreezeExitTile()) + { + for (Habbo habbo : this.room.getHabbos()) + { + if (this.getTeamForHabbo(habbo) == null) + { + for (HabboItem item : this.room.getItemsAt(habbo.getRoomUnit().getCurrentLocation())) + { + if (item instanceof InteractionFreezeTile) + { + HabboItem exitTile = this.room.getRoomSpecialTypes().getRandomFreezeExitTile(); + WiredEffectTeleport.teleportUnitToTile(habbo.getRoomUnit(), this.room.getLayout().getTile(exitTile.getX(), exitTile.getY())); + } + } + } + } + } + this.refreshGates(); - + this.setFreezeTileState("1"); this.run(); } diff --git a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGameTeam.java b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGameTeam.java index d92f11b7..49831106 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGameTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGameTeam.java @@ -4,6 +4,8 @@ import com.eu.habbo.habbohotel.games.Game; import com.eu.habbo.habbohotel.games.GamePlayer; import com.eu.habbo.habbohotel.games.GameTeam; import com.eu.habbo.habbohotel.games.GameTeamColors; +import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate; +import com.eu.habbo.habbohotel.rooms.Room; public class FreezeGameTeam extends GameTeam { @@ -16,15 +18,18 @@ public class FreezeGameTeam extends GameTeam public void removeMember(GamePlayer gamePlayer) { Game game = gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().getGame(FreezeGame.class); - if(game instanceof FreezeGame) - { - ((FreezeGame) game).placebackHelmet(gamePlayer.getTeamColor()); - } + Room room = gamePlayer.getHabbo().getRoomUnit().getRoom(); gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gamePlayer.getHabbo(), 0, -1); gamePlayer.getHabbo().getRoomUnit().setCanWalk(true); super.removeMember(gamePlayer); + + if(room != null && room.getRoomSpecialTypes() != null) { + for (InteractionGameGate gate : room.getRoomSpecialTypes().getFreezeGates().values()) { + gate.updateState(game, 5); + } + } } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameGate.java index ddca2a55..e5fc6212 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameGate.java @@ -1,5 +1,6 @@ package com.eu.habbo.habbohotel.items.interactions.games; +import com.eu.habbo.habbohotel.games.Game; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; @@ -14,11 +15,13 @@ public abstract class InteractionGameGate extends InteractionGameTeamItem public InteractionGameGate(ResultSet set, Item baseItem, GameTeamColors teamColor) throws SQLException { super(set, baseItem, teamColor); + this.setExtradata("0"); } public InteractionGameGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { super(id, userId, item, extradata, limitedStack, limitedSells, teamColor); + this.setExtradata("0"); } @Override @@ -41,4 +44,13 @@ public abstract class InteractionGameGate extends InteractionGameTeamItem super.serializeExtradata(serverMessage); } + + public void updateState(Game game, int maxPlayers) { + int memberCount = game.getTeam(this.teamColor).getMembers().size(); + if(memberCount > maxPlayers) { + memberCount = maxPlayers; + } + this.setExtradata(memberCount + ""); + game.getRoom().updateItem(this); + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java index 8c8064d5..81e6df9d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java @@ -59,6 +59,9 @@ public abstract class InteractionGameTimer extends HabboItem implements Runnable super.run(); } + if(this.getRoomId() == 0) + return; + Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); if(room == null || !this.isRunning || this.isPaused) @@ -89,16 +92,26 @@ public abstract class InteractionGameTimer extends HabboItem implements Runnable } public static void endGames(Room room) { + endGames(room, false); + } + + public static void endGames(Room room, boolean overrideTriggerWired) { + + boolean triggerWired = false; + //end existing games for (Class gameClass : Emulator.getGameEnvironment().getRoomManager().getGameTypes()) { Game game = InteractionGameTimer.getOrCreateGame(room, gameClass); if (!game.state.equals(GameState.IDLE)) { + triggerWired = true; game.onEnd(); game.stop(); } } - WiredHandler.handle(WiredTriggerType.GAME_ENDS, null, room, new Object[] { }); + if(triggerWired) { + WiredHandler.handle(WiredTriggerType.GAME_ENDS, null, room, new Object[]{}); + } } @Override @@ -151,27 +164,12 @@ public abstract class InteractionGameTimer extends HabboItem implements Runnable // if wired triggered it if (objects.length >= 2 && objects[1] instanceof WiredEffectType && !this.isRunning) { - boolean gamesActive = false; - for(InteractionGameTimer timer : room.getRoomSpecialTypes().getGameTimers().values()) - { - if(timer.isRunning()) - gamesActive = true; - } - - if(gamesActive) { - //stop existing games - for(Class gameClass : Emulator.getGameEnvironment().getRoomManager().getGameTypes()) { - Game game = getOrCreateGame(room, gameClass); - if(game.isRunning) { - game.stop(); - } - } - } + endGamesIfLastTimer(room); for(Class gameClass : Emulator.getGameEnvironment().getRoomManager().getGameTypes()) { Game game = getOrCreateGame(room, gameClass); if(!game.isRunning) { - game.start(); + game.initialise(); } } @@ -196,13 +194,18 @@ public abstract class InteractionGameTimer extends HabboItem implements Runnable switch (state) { case 1: - if(this.isRunning) { this.isPaused = !this.isPaused; + boolean allPaused = this.isPaused; + for(InteractionGameTimer timer : room.getRoomSpecialTypes().getGameTimers().values()) { + if(!timer.isPaused) + allPaused = false; + } + for(Class gameClass : Emulator.getGameEnvironment().getRoomManager().getGameTypes()) { Game game = getOrCreateGame(room, gameClass); - if(this.isPaused) { + if(allPaused) { game.pause(); } else { @@ -211,24 +214,26 @@ public abstract class InteractionGameTimer extends HabboItem implements Runnable } if(!this.isPaused) { + this.isRunning = true; + timeNow = this.baseTime; + room.updateItem(this); Emulator.getThreading().run(this); } } if(!this.isRunning) { + endGamesIfLastTimer(room); + for(Class gameClass : Emulator.getGameEnvironment().getRoomManager().getGameTypes()) { Game game = getOrCreateGame(room, gameClass); game.initialise(); } WiredHandler.handle(WiredTriggerType.GAME_STARTS, null, room, new Object[] { }); - Emulator.getThreading().run(this); - } - - if(!this.isRunning) { - timeNow = this.baseTime; this.isRunning = true; + timeNow = this.baseTime; room.updateItem(this); + Emulator.getThreading().run(this); } break; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGate.java index 95c08794..28637cba 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGate.java @@ -1,6 +1,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.games.GamePlayer; import com.eu.habbo.habbohotel.games.GameState; import com.eu.habbo.habbohotel.games.GameTeam; import com.eu.habbo.habbohotel.games.GameTeamColors; @@ -9,6 +10,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; +import gnu.trove.set.hash.THashSet; import java.sql.ResultSet; import java.sql.SQLException; @@ -67,18 +69,11 @@ public class InteractionBattleBanzaiGate extends InteractionGameGate } else { - if(this.getExtradata().isEmpty()) - { - this.setExtradata("0"); - } - - int value = Integer.valueOf(this.getExtradata()) + 1; - - this.setExtradata(value + ""); - room.updateItem(this); game.addHabbo(room.getHabbo(roomUnit), this.teamColor); } + updateState(game, 5); + super.onWalkOn(roomUnit, room, objects); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGate.java index 0bebee7f..46ffbe68 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGate.java @@ -66,18 +66,11 @@ public class InteractionFreezeGate extends InteractionGameGate } else { - if(this.getExtradata().isEmpty()) - { - this.setExtradata("0"); - } - - int value = Integer.valueOf(this.getExtradata()) + 1; - - this.setExtradata(value + ""); - room.updateItem(this); game.addHabbo(room.getHabbo(roomUnit), this.teamColor); } + updateState(game, 5); + super.onWalkOn(roomUnit, room, objects); } } 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 917dd042..b1b91c61 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 @@ -94,11 +94,8 @@ public class WiredEffectBotTalk extends InteractionWiredEffect } List bots = room.getBots(this.botName); - int now = Emulator.getIntUnixTimestamp(); for(Bot bot : bots) { - if (now - bot.getChatTimestamp() < bot.getChatDelay()) continue; - if(this.mode == 1) bot.shout(message); else 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 72e24eef..11463890 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 @@ -119,6 +119,50 @@ public class WiredEffectTeleport extends InteractionWiredEffect return true; } + public static void teleportUnitToTile(RoomUnit roomUnit, RoomTile tile) { + Room room = roomUnit.getRoom(); + + // makes a temporary effect + room.sendComposer(new RoomUserEffectComposer(roomUnit, 4).compose()); + Emulator.getThreading().run(new SendRoomUnitEffectComposer(room, roomUnit), WiredHandler.TELEPORT_DELAY); + + if (tile.state == RoomTileState.INVALID || tile.state == RoomTileState.BLOCKED) + { + RoomTile alternativeTile = null; + List optionalTiles = room.getLayout().getTilesAround(tile); + + Collections.reverse(optionalTiles); + for (RoomTile optionalTile : optionalTiles) + { + if (optionalTile.state != RoomTileState.INVALID && optionalTile.state != RoomTileState.BLOCKED) + { + alternativeTile = optionalTile; + } + } + + if(alternativeTile != null) { + tile = alternativeTile; + } + } + + Emulator.getThreading().run(new RoomUnitTeleport(roomUnit, room, tile.x, tile.y, tile.getStackHeight() + (tile.state == RoomTileState.SIT ? -0.5 : 0) , roomUnit.getEffectId()), WiredHandler.TELEPORT_DELAY); + + HabboItem topItem = room.getTopItemAt(tile.x, tile.y); + + if(topItem != null) { + Emulator.getThreading().run(new Runnable() { + @Override + public void run() { + try { + topItem.onWalkOn(roomUnit, room, new Object[] { }); + } catch (Exception e) { + } + } + }, WiredHandler.TELEPORT_DELAY); + } + + } + @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { @@ -146,52 +190,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect tryCount++; HabboItem item = this.items.get((tryCount - 1 + i) % this.items.size()); - int currentEffect = roomUnit.getEffectId(); - - // makes a temporary effect - room.sendComposer(new RoomUserEffectComposer(roomUnit, 4).compose()); - Emulator.getThreading().run(new SendRoomUnitEffectComposer(room, roomUnit), 2000); - - final WiredEffectTeleport teleportWired = this; - RoomTile targetTile = room.getLayout().getTile(item.getX(), item.getY()); - boolean foundTile = false; - if (targetTile.state == RoomTileState.INVALID || targetTile.state == RoomTileState.BLOCKED) - { - List optionalTiles = room.getLayout().getTilesAround(targetTile, item.getRotation() + 3); - - Collections.reverse(optionalTiles); - for (RoomTile tile : optionalTiles) - { - if (tile.state != RoomTileState.INVALID && tile.state != RoomTileState.BLOCKED) - { - targetTile = tile; - foundTile = true; - } - } - } - else - { - foundTile = true; - } - if (!foundTile) - { - continue; - } - - Emulator.getThreading().run(new RoomUnitTeleport(roomUnit, room, targetTile.x, targetTile.y, targetTile.getStackHeight() + (targetTile.state == RoomTileState.SIT ? -0.5 : 0) , currentEffect), WiredHandler.TELEPORT_DELAY); - Emulator.getThreading().run(new Runnable() - { - @Override - public void run() - { - try - { - item.onWalkOn(roomUnit, room, new Object[]{teleportWired}); - } - catch (Exception e) - {} - } - }, WiredHandler.TELEPORT_DELAY); + teleportUnitToTile(roomUnit, room.getLayout().getTile(item.getX(), item.getY())); break; }