From be7fc169352ac0d8a5f06a4819b4b87484f7e55f Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Sat, 18 May 2019 16:59:41 +0300 Subject: [PATCH] Fix disappearing staff picked & public rooms. Closes #96 --- .../com/eu/habbo/habbohotel/GameEnvironment.java | 1 + .../habbohotel/navigation/NavigatorManager.java | 8 +++++++- .../com/eu/habbo/habbohotel/rooms/RoomManager.java | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java b/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java index a9097efe..09d5aec1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java +++ b/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java @@ -71,6 +71,7 @@ public class GameEnvironment this.pollManager = new PollManager(); this.roomManager.loadPublicRooms(); + this.navigatorManager.loadNavigator(); this.creditsScheduler = new CreditsScheduler(); Emulator.getThreading().run(this.creditsScheduler); diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java index ba96d138..9f289c91 100644 --- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java @@ -9,6 +9,7 @@ import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; +import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -27,7 +28,6 @@ public class NavigatorManager public NavigatorManager() { long millis = System.currentTimeMillis(); - this.loadNavigator(); this.filters.put(NavigatorPublicFilter.name, new NavigatorPublicFilter()); this.filters.put(NavigatorHotelFilter.name, new NavigatorHotelFilter()); @@ -139,6 +139,12 @@ public class NavigatorManager { Emulator.getLogging().logSQLException(e); } + + List staffPromotedRooms = Emulator.getGameEnvironment().getRoomManager().getRoomsStaffPromoted(); + + for (Room room : staffPromotedRooms) { + this.publicCategories.get(Emulator.getConfig().getInt("hotel.navigator.staffpicks.categoryid")).addRoom(room); + } } public NavigatorFilterComparator comperatorForField(Method field) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index 66884b2f..c2fd8b37 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -1598,6 +1598,20 @@ public class RoomManager return r; } + public ArrayList getRoomsStaffPromoted() { + ArrayList r = new ArrayList<>(); + + for(Room room : this.getActiveRooms()) + { + if(room.isStaffPromotedRoom()) + { + r.add(room); + } + } + + return r; + } + public List filterRoomsByOwner(List rooms, String filter) { ArrayList r = new ArrayList<>();