You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-19 15:06:19 +00:00
🆙 Navigator Group Filter
This commit is contained in:
@@ -158,12 +158,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
private String tags;
|
||||
private boolean publicRoom;
|
||||
private boolean staffPromotedRoom;
|
||||
// Read every room cycle (processBots/processPets) but written from settings/
|
||||
// admin packet handlers on another thread — volatile for cross-thread visibility.
|
||||
private volatile boolean allowPets;
|
||||
private volatile boolean allowPetsEat;
|
||||
private boolean allowPets;
|
||||
private boolean allowPetsEat;
|
||||
private boolean allowWalkthrough;
|
||||
private volatile boolean allowBotsWalk;
|
||||
private boolean allowBotsWalk;
|
||||
private boolean allowEffects;
|
||||
private boolean hideWall;
|
||||
private int chatMode;
|
||||
@@ -1028,10 +1026,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
com.eu.habbo.habbohotel.wired.core.WiredManager.getEngine().clearRoomDiagnostics(this.id);
|
||||
}
|
||||
|
||||
// Drop this room's shared wired-variable assignment caches (otherwise
|
||||
// they accrue per (room, item, user) for the JVM lifetime).
|
||||
com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredVariableReferenceSupport.invalidateRoom(this.id);
|
||||
|
||||
this.itemManager.clear();
|
||||
|
||||
this.unitManager.clearQueue();
|
||||
@@ -1499,6 +1493,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
return this.getGuildId() != 0;
|
||||
}
|
||||
|
||||
public boolean belongsToGuild() {
|
||||
return this.guild > 0;
|
||||
}
|
||||
|
||||
public void setGuild(int guild) {
|
||||
this.guild = guild;
|
||||
}
|
||||
|
||||
+12
@@ -5,6 +5,13 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.navigator.NewNavigatorSavedSearchesComposer;
|
||||
|
||||
public class AddSavedSearchEvent extends MessageHandler {
|
||||
private static final int MAX_SAVED_SEARCHES = 50;
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
String searchCode = this.packet.readString();
|
||||
@@ -13,6 +20,11 @@ public class AddSavedSearchEvent extends MessageHandler {
|
||||
if (searchCode.length() > 255) searchCode = searchCode.substring(0, 255);
|
||||
if (filter.length() > 255) filter = filter.substring(0, 255);
|
||||
|
||||
if (this.client.getHabbo().getHabboInfo().getSavedSearches().size() >= MAX_SAVED_SEARCHES) {
|
||||
this.client.sendResponse(new NewNavigatorSavedSearchesComposer(this.client.getHabbo().getHabboInfo().getSavedSearches()));
|
||||
return;
|
||||
}
|
||||
|
||||
this.client.getHabbo().getHabboInfo().addSavedSearch(new NavigatorSavedSearch(searchCode, filter));
|
||||
|
||||
this.client.sendResponse(new NewNavigatorSavedSearchesComposer(this.client.getHabbo().getHabboInfo().getSavedSearches()));
|
||||
|
||||
+5
@@ -5,6 +5,11 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.navigator.NewNavigatorSavedSearchesComposer;
|
||||
|
||||
public class DeleteSavedSearchEvent extends MessageHandler {
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int searchId = this.packet.readInt();
|
||||
|
||||
+18
-18
@@ -15,12 +15,20 @@ import java.util.*;
|
||||
|
||||
public class RequestNewNavigatorRoomsEvent extends MessageHandler {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RequestNewNavigatorRoomsEvent.class);
|
||||
private static final int MAX_VIEW_LENGTH = 32;
|
||||
private static final int MAX_QUERY_LENGTH = 64;
|
||||
|
||||
@Override
|
||||
public int getRatelimit() {
|
||||
return 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
String view = this.packet.readString();
|
||||
String query = this.packet.readString();
|
||||
|
||||
if (view.length() > MAX_VIEW_LENGTH) return;
|
||||
if (query.length() > MAX_QUERY_LENGTH) query = query.substring(0, MAX_QUERY_LENGTH);
|
||||
if (view.equals("query")) view = "hotel_view";
|
||||
if (view.equals("groups")) view = "hotel_view";
|
||||
|
||||
@@ -43,7 +51,7 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler {
|
||||
NavigatorFilterField field = Emulator.getGameEnvironment().getNavigatorManager().filterSettings.get(filterField);
|
||||
if (filter != null) {
|
||||
if (query.contains(":")) {
|
||||
String[] parts = query.split(":");
|
||||
String[] parts = query.split(":", 2);
|
||||
|
||||
if (parts.length > 1) {
|
||||
filterField = parts[0];
|
||||
@@ -53,6 +61,7 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler {
|
||||
if (!Emulator.getGameEnvironment().getNavigatorManager().filterSettings.containsKey(filterField)) {
|
||||
filterField = "anything";
|
||||
}
|
||||
part = "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,28 +104,19 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler {
|
||||
rooms.addAll(searchResultList.rooms);
|
||||
resultLists.add(new SearchResultList(searchResultList.order, searchResultList.code, searchResultList.query, searchResultList.action, searchResultList.mode, searchResultList.hidden, rooms, searchResultList.filter, searchResultList.showInvisible, searchResultList.displayOrder, searchResultList.categoryOrder));
|
||||
}
|
||||
if ("group".equals(filterField)) {
|
||||
final String needle = part.toLowerCase();
|
||||
for (SearchResultList list : resultLists) {
|
||||
list.rooms.removeIf(room -> !room.belongsToGuild()
|
||||
|| (!needle.isEmpty() && !room.getGuildName().toLowerCase().contains(needle)));
|
||||
}
|
||||
}
|
||||
filter.filter(field.field, part, resultLists);
|
||||
resultLists = toQueryResults(resultLists);
|
||||
this.client.sendResponse(new NewNavigatorSearchResultsComposer(view, query, resultLists));
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Caught exception", e);
|
||||
}
|
||||
|
||||
/*
|
||||
try
|
||||
{
|
||||
|
||||
List<SearchResultList> resultLists = new ArrayList<>(filter.getResult(this.client.getHabbo(), field, part, category != null ? category.getId() : -1));
|
||||
filter.filter(field.field, part, resultLists);
|
||||
|
||||
Collections.sort(resultLists);
|
||||
this.client.sendResponse(new NewNavigatorSearchResultsComposer(view, query, resultLists));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error("Caught exception", e);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private ArrayList<SearchResultList> toQueryResults(List<SearchResultList> resultLists) {
|
||||
|
||||
Reference in New Issue
Block a user