mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Load navigator after removing a room
This commit is contained in:
parent
0a3877db1b
commit
6d23533abd
@ -156,6 +156,9 @@ public class NavigatorManager {
|
|||||||
case "with_friends":
|
case "with_friends":
|
||||||
rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsWithFriendsIn(habbo, 25);
|
rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsWithFriendsIn(habbo, 25);
|
||||||
break;
|
break;
|
||||||
|
case "highest_score":
|
||||||
|
rooms = Emulator.getGameEnvironment().getRoomManager().getTopRatedRooms(25);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1236,14 +1236,20 @@ public class RoomManager {
|
|||||||
public List<Room> getGroupRooms(Habbo habbo, int limit) {
|
public List<Room> getGroupRooms(Habbo habbo, int limit) {
|
||||||
final ArrayList<Room> rooms = new ArrayList<>();
|
final ArrayList<Room> rooms = new ArrayList<>();
|
||||||
|
|
||||||
for (Guild guild : Emulator.getGameEnvironment().getGuildManager().getGuilds(habbo.getHabboInfo().getId())) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection();
|
||||||
if (guild.getOwnerId() != habbo.getHabboInfo().getId()) {
|
PreparedStatement statement = connection.prepareStatement("SELECT rooms.* FROM rooms INNER JOIN guilds_members ON guilds_members.guild_id = rooms.guild_id WHERE guilds_members.user_id = ? AND level_id != 3")) {
|
||||||
Room room = this.getRoom(guild.getRoomId());
|
statement.setInt(1, habbo.getHabboInfo().getId());
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
if (room != null) {
|
while (set.next()) {
|
||||||
rooms.add(room);
|
if (this.activeRooms.containsKey(set.getInt("id"))) {
|
||||||
|
rooms.add(this.activeRooms.get(set.getInt("id")));
|
||||||
|
} else {
|
||||||
|
rooms.add(new Room(set));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Emulator.getLogging().logSQLException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(rooms);
|
Collections.sort(rooms);
|
||||||
@ -1291,6 +1297,29 @@ public class RoomManager {
|
|||||||
return rooms;
|
return rooms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Room> getTopRatedRooms(int limit) {
|
||||||
|
final ArrayList<Room> rooms = new ArrayList<>();
|
||||||
|
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection();
|
||||||
|
PreparedStatement statement = connection.prepareStatement("SELECT * FROM rooms ORDER BY score DESC LIMIT ?")) {
|
||||||
|
statement.setInt(1, limit);
|
||||||
|
|
||||||
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
|
while (set.next()) {
|
||||||
|
if (this.activeRooms.containsKey(set.getInt("id"))) {
|
||||||
|
rooms.add(this.activeRooms.get(set.getInt("id")));
|
||||||
|
} else {
|
||||||
|
rooms.add(new Room(set));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Emulator.getLogging().logSQLException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rooms;
|
||||||
|
}
|
||||||
|
|
||||||
public ArrayList<Room> getRoomsWithAdminRights(Habbo habbo) {
|
public ArrayList<Room> getRoomsWithAdminRights(Habbo habbo) {
|
||||||
ArrayList<Room> rooms = new ArrayList<>();
|
ArrayList<Room> rooms = new ArrayList<>();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user