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()); + } } }