Add my friends category to my world in navigator

This commit is contained in:
Alejandro 2019-05-27 23:17:54 +03:00
parent 5943d1f060
commit ae555d29fb
4 changed files with 30 additions and 1 deletions

View File

@ -153,6 +153,9 @@ public class NavigatorManager {
case "categories":
rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsPromoted();
break;
case "with_friends":
rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsWithFriendsIn(habbo, 25);
break;
default:
return null;
}

View File

@ -42,6 +42,12 @@ public class NavigatorUserFilter extends NavigatorFilter {
i++;
}
List<Room> friendRooms = Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("with_friends", habbo);
if (!friendRooms.isEmpty()) {
resultLists.add(new SearchResultList(i, "with_friends", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("with_friends"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("with_friends"), friendRooms, true, true, DisplayOrder.ORDER_NUM, i));
i++;
}
List<Room> rightRooms = Emulator.getGameEnvironment().getNavigatorManager().getRoomsForCategory("with_rights", habbo);
if (!rightRooms.isEmpty()) {
resultLists.add(new SearchResultList(i, "with_rights", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("with_rights"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("with_rights"), rightRooms, true, true, DisplayOrder.ORDER_NUM, i));

View File

@ -54,6 +54,7 @@ import gnu.trove.set.hash.THashSet;
import java.sql.*;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
public class RoomManager {
private static final int page = 0;
@ -1271,6 +1272,25 @@ public class RoomManager {
return rooms;
}
public ArrayList<Room> getRoomsWithFriendsIn(Habbo habbo, int limit) {
final ArrayList<Room> rooms = new ArrayList<>();
for (MessengerBuddy buddy : habbo.getMessenger().getFriends().values()) {
Habbo friend = Emulator.getGameEnvironment().getHabboManager().getHabbo(buddy.getId());
if (friend == null || friend.getHabboInfo() == null) continue;
Room room = friend.getHabboInfo().getCurrentRoom();
if (room != null) rooms.add(room);
if (rooms.size() >= limit) break;
}
Collections.sort(rooms);
return rooms;
}
public ArrayList<Room> getRoomsWithAdminRights(Habbo habbo) {
ArrayList<Room> rooms = new ArrayList<>();

View File

@ -326,7 +326,7 @@ public class HabboStats implements Runnable {
statement.setString(31, this.allowTrade ? "1" : "0");
statement.setInt(32, this.forumPostsCount);
statement.setInt(33, this.uiFlags);
statement.setInt(34, this.habboInfo.getId());
statement.executeUpdate();
}