From b1ea3dfd664c2d0f4f4677f21462707a9d89ea6a Mon Sep 17 00:00:00 2001 From: AlfreviD Date: Sun, 10 Apr 2022 16:07:50 +0000 Subject: [PATCH] Fix Issue #948 --- .../com/eu/habbo/habbohotel/rooms/Room.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index 09c54558..f0c214ca 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -4124,15 +4124,23 @@ public class Room implements Comparable, ISerialize, Runnable { } public void giveEffect(RoomUnit roomUnit, int effectId, int duration) { - if (duration == -1 || duration == Integer.MAX_VALUE) { - duration = Integer.MAX_VALUE; - } else { - duration += Emulator.getIntUnixTimestamp(); - } + if(roomUnit == null) return; - if (this.allowEffects && roomUnit != null) { - roomUnit.setEffectId(effectId, duration); - this.sendComposer(new RoomUserEffectComposer(roomUnit).compose()); + Habbo habbo = roomUnit.getRoom().getHabbo(roomUnit); + + if(habbo == null) return; + + if (!habbo.getHabboInfo().isInGame()) { + if (duration == -1 || duration == Integer.MAX_VALUE) { + duration = Integer.MAX_VALUE; + } else { + duration += Emulator.getIntUnixTimestamp(); + } + + if (this.allowEffects) { + roomUnit.setEffectId(effectId, duration); + this.sendComposer(new RoomUserEffectComposer(roomUnit).compose()); + } } }