diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index a5d847a..14f83e9 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -203,6 +203,7 @@ public class Room implements Comparable, ISerialize, Runnable { private volatile boolean loaded; private volatile boolean preLoaded; private int idleCycles; + private int idleHostingCycles; private volatile int unitCounter; private volatile int rollerSpeed; private final int muteTime = Emulator.getConfig().getInt("hotel.flood.mute.time", 30); @@ -368,6 +369,7 @@ public class Room implements Comparable, ISerialize, Runnable { } this.idleCycles = 0; + this.idleHostingCycles = 0; this.loaded = true; this.roomCycleTask = Emulator.getThreading().getService().scheduleAtFixedRate(this, 500, 500, TimeUnit.MILLISECONDS); @@ -1211,6 +1213,19 @@ public class Room implements Comparable, ISerialize, Runnable { task.cycle(this); } + if (Emulator.getConfig().getBoolean("hotel.rooms.deco_hosting")) { + if (this.idleHostingCycles < 120) { + this.idleHostingCycles++; + } else { + this.idleHostingCycles = 0; + + int amount = (int) this.currentHabbos.values().stream().filter(habbo -> habbo.getHabboInfo().getId() != this.ownerId).count(); + if (amount > 0) { + AchievementManager.progressAchievement(this.ownerId, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHosting"), amount); + } + } + } + if (!this.currentHabbos.isEmpty()) { this.idleCycles = 0; @@ -1268,19 +1283,6 @@ public class Room implements Comparable, ISerialize, Runnable { } } - if (Emulator.getConfig().getBoolean("hotel.rooms.deco_hosting")) { - //Check if the user isn't the owner id - if (this.ownerId != habbo.getHabboInfo().getId()) { - //Check if the time already have 1 minute (120 / 2 = 60s) - if (habbo.getRoomUnit().getTimeInRoom() >= 120) { - AchievementManager.progressAchievement(this.ownerId, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHosting")); - habbo.getRoomUnit().resetTimeInRoom(); - } else { - habbo.getRoomUnit().increaseTimeInRoom(); - } - } - } - if (habbo.getHabboStats().mutedBubbleTracker && habbo.getHabboStats().allowTalk()) { habbo.getHabboStats().mutedBubbleTracker = false; this.sendComposer(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.UNIGNORED).compose()); diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java index 11d8845..f10ce28 100644 --- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java +++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java @@ -73,7 +73,6 @@ public class RoomUnit { private int effectId; private int effectEndTimestamp; private ScheduledFuture moveBlockingTask; - private int timeInRoom; private int idleTimer; private Room room; @@ -95,7 +94,6 @@ public class RoomUnit { this.effectId = 0; this.isKicked = false; this.overridableTiles = new THashSet<>(); - this.timeInRoom = 0; this.isGameSnow = false; } @@ -663,18 +661,6 @@ public class RoomUnit { this.walkTimeOut = walkTimeOut; } - public void increaseTimeInRoom() { - this.timeInRoom++; - } - - public int getTimeInRoom() { - return this.timeInRoom; - } - - public void resetTimeInRoom() { - this.timeInRoom = 0; - } - public void increaseIdleTimer() { this.idleTimer++; } diff --git a/Latest_Compiled_Version/Habbo-3.6.0-jar-with-dependencies.jar b/Latest_Compiled_Version/Habbo-3.6.0-jar-with-dependencies.jar index efce265..95317f8 100644 Binary files a/Latest_Compiled_Version/Habbo-3.6.0-jar-with-dependencies.jar and b/Latest_Compiled_Version/Habbo-3.6.0-jar-with-dependencies.jar differ