🆙 Updates Mention

This commit is contained in:
duckietm
2026-06-04 10:43:05 +02:00
parent 2171b5f2ec
commit 85758b53fa
2 changed files with 32 additions and 17 deletions
@@ -9,18 +9,8 @@ import com.eu.habbo.habbohotel.users.HabboManager;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.sql.Connection; import java.sql.*;
import java.sql.PreparedStatement; import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class MentionManager { public class MentionManager {
@@ -43,7 +33,6 @@ public class MentionManager {
return Emulator.getConfig().getInt("mentions.enabled", 1) == 1; return Emulator.getConfig().getInt("mentions.enabled", 1) == 1;
} }
/** Broadcast category resolved from a mention alias. */
public enum BroadcastScope { public enum BroadcastScope {
NONE, NONE,
ROOM, ROOM,
@@ -249,7 +238,9 @@ public class MentionManager {
} }
private boolean acceptsMention(Habbo recipient, boolean isBroadcast) { private boolean acceptsMention(Habbo recipient, boolean isBroadcast) {
if (recipient == null || recipient.getHabboStats() == null) return true; if (recipient == null) return false;
if (recipient.getClient() == null) return false;
if (recipient.getHabboStats() == null) return false;
if (!recipient.getHabboStats().mentionsEnabled()) return false; if (!recipient.getHabboStats().mentionsEnabled()) return false;
if (isBroadcast && !recipient.getHabboStats().massMentionsEnabled()) return false; if (isBroadcast && !recipient.getHabboStats().massMentionsEnabled()) return false;
return true; return true;
@@ -423,13 +414,37 @@ public class MentionManager {
return value.substring(0, max); return value.substring(0, max);
} }
private boolean isBotOrPetName(Room room, String token) {
if (room == null || token == null || token.isEmpty()) return false;
List<com.eu.habbo.habbohotel.bots.Bot> bots = room.getBots(token);
if (bots != null && !bots.isEmpty()) return true;
if (room.getUnitManager() != null && room.getUnitManager().getPets() != null) {
for (com.eu.habbo.habbohotel.pets.Pet pet : room.getUnitManager().getPets()) {
if (pet != null && pet.getName() != null && pet.getName().equalsIgnoreCase(token)) {
return true;
}
}
}
return false;
}
private Habbo resolveHabbo(Room room, String rawToken) { private Habbo resolveHabbo(Room room, String rawToken) {
if (isBotOrPetName(room, rawToken)) {
return null;
}
String trimmedForBotCheck = trimTrailingPunctuation(rawToken);
if (!trimmedForBotCheck.equals(rawToken) && isBotOrPetName(room, trimmedForBotCheck)) {
return null;
}
Habbo habbo = room.getHabbo(rawToken); Habbo habbo = room.getHabbo(rawToken);
if (habbo != null) { if (habbo != null) {
return habbo; return habbo;
} }
// Hotel-wide fallback: a @nick mention must reach the target even when
// they are online in a different room (not just the sender's room).
HabboManager habboManager = Emulator.getGameEnvironment().getHabboManager(); HabboManager habboManager = Emulator.getGameEnvironment().getHabboManager();
habbo = habboManager.getHabbo(rawToken); habbo = habboManager.getHabbo(rawToken);
if (habbo != null) { if (habbo != null) {
+1 -1
View File
@@ -10,7 +10,7 @@ and is developed for free by talented developers and is compatible with the foll
[Latest compiled version](https://github.com/duckietm/Arcturus-Morningstar-Extended/tree/main/Latest_Compiled_Version) [Latest compiled version](https://github.com/duckietm/Arcturus-Morningstar-Extended/tree/main/Latest_Compiled_Version)
## Connection ## ## Connection ##
Use the Websocket plugin! Use the BUILD-IN Websocket so do NOT load any websocket plugin!
### How do I connect to my emulator using Secure Websockets (wss)? ### How do I connect to my emulator using Secure Websockets (wss)?
You have several options to add WSS support to your websocket server. You have several options to add WSS support to your websocket server.