From 30c2936050f6440e4a42794c70b935971d6898db Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Tue, 28 May 2019 20:28:44 +0300 Subject: [PATCH] Make teleporters invalidate room kick at door --- .../items/interactions/InteractionTeleport.java | 5 +++++ .../java/com/eu/habbo/habbohotel/rooms/RoomUnit.java | 9 ++++++++- .../java/com/eu/habbo/habbohotel/users/HabboItem.java | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java index 94f219b8..102af6be 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java @@ -216,4 +216,9 @@ public class InteractionTeleport extends HabboItem { public boolean isUsable() { return true; } + + @Override + public boolean invalidatesToRoomKick() { + return true; + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java index a9e66571..c74236cf 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.rooms; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionGuildGate; +import com.eu.habbo.habbohotel.items.interactions.InteractionTeleport; import com.eu.habbo.habbohotel.pets.Pet; import com.eu.habbo.habbohotel.pets.RideablePet; import com.eu.habbo.habbohotel.users.DanceType; @@ -332,7 +333,13 @@ public class RoomUnit { this.resetIdleTimer(); if (habbo != null) { - if (this.canLeaveRoomByDoor && next.x == room.getLayout().getDoorX() && next.y == room.getLayout().getDoorY() && (!room.isPublicRoom()) || (room.isPublicRoom() && Emulator.getConfig().getBoolean("hotel.room.public.doortile.kick"))) { + HabboItem topItem = this.room.getTopItemAt(next.x, next.y); + + boolean isAtDoor = next.x == room.getLayout().getDoorX() && next.y == room.getLayout().getDoorY(); + boolean publicRoomKicks = !room.isPublicRoom() || Emulator.getConfig().getBoolean("hotel.room.public.doortile.kick"); + boolean invalidated = topItem != null && topItem.invalidatesToRoomKick(); + + if (this.canLeaveRoomByDoor && isAtDoor && publicRoomKicks && !invalidated) { Emulator.getThreading().run(new RoomUnitKick(habbo, room, false), 500); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java index 53711bec..66cdaf73 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java @@ -462,4 +462,6 @@ public abstract class HabboItem implements Runnable, IEventTriggers { public void setFromGift(boolean fromGift) { isFromGift = fromGift; } + + public boolean invalidatesToRoomKick() { return false; } }