Fix disappearing staff picked & public rooms. Closes #96

This commit is contained in:
Alejandro 2019-05-18 16:59:41 +03:00
parent 57bb88bc17
commit be7fc16935
3 changed files with 22 additions and 1 deletions

View File

@ -71,6 +71,7 @@ public class GameEnvironment
this.pollManager = new PollManager(); this.pollManager = new PollManager();
this.roomManager.loadPublicRooms(); this.roomManager.loadPublicRooms();
this.navigatorManager.loadNavigator();
this.creditsScheduler = new CreditsScheduler(); this.creditsScheduler = new CreditsScheduler();
Emulator.getThreading().run(this.creditsScheduler); Emulator.getThreading().run(this.creditsScheduler);

View File

@ -9,6 +9,7 @@ import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -27,7 +28,6 @@ public class NavigatorManager
public NavigatorManager() public NavigatorManager()
{ {
long millis = System.currentTimeMillis(); long millis = System.currentTimeMillis();
this.loadNavigator();
this.filters.put(NavigatorPublicFilter.name, new NavigatorPublicFilter()); this.filters.put(NavigatorPublicFilter.name, new NavigatorPublicFilter());
this.filters.put(NavigatorHotelFilter.name, new NavigatorHotelFilter()); this.filters.put(NavigatorHotelFilter.name, new NavigatorHotelFilter());
@ -139,6 +139,12 @@ public class NavigatorManager
{ {
Emulator.getLogging().logSQLException(e); Emulator.getLogging().logSQLException(e);
} }
List<Room> 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) public NavigatorFilterComparator comperatorForField(Method field)

View File

@ -1598,6 +1598,20 @@ public class RoomManager
return r; return r;
} }
public ArrayList<Room> getRoomsStaffPromoted() {
ArrayList<Room> r = new ArrayList<>();
for(Room room : this.getActiveRooms())
{
if(room.isStaffPromotedRoom())
{
r.add(room);
}
}
return r;
}
public List<Room> filterRoomsByOwner(List<Room> rooms, String filter) public List<Room> filterRoomsByOwner(List<Room> rooms, String filter)
{ {
ArrayList<Room> r = new ArrayList<>(); ArrayList<Room> r = new ArrayList<>();