Merge branch 'fix-wordfilter-habbo-null' into 'ms4/dev'

Check if habbo != null when applying wordFilter + use habbo when filtering bot texts/name

See merge request morningstar/Arcturus-Community!59
This commit is contained in:
John 2023-02-08 01:31:13 +00:00
commit ffd01c2965
2 changed files with 3 additions and 3 deletions

View File

@ -125,7 +125,7 @@ public class WordFilter {
public String filter(String message, Habbo habbo) {
String filteredMessage = message;
if (!Emulator.getConfig().getBoolean("hotel.wordfilter.enabled", true) || habbo.hasPermission(Permission.ACC_CHAT_NO_FILTER)) {
if (!Emulator.getConfig().getBoolean("hotel.wordfilter.enabled", true) || (habbo != null && habbo.hasPermission(Permission.ACC_CHAT_NO_FILTER))) {
return message;
}
if (Emulator.getConfig().getBoolean("hotel.wordfilter.normalise")) {

View File

@ -71,7 +71,7 @@ public class CommandBotEvent extends MessageHandler {
count++;
}
String result = Emulator.getGameEnvironment().getWordFilter().filter(s, null);
String result = Emulator.getGameEnvironment().getWordFilter().filter(s, this.client.getHabbo());
if (!result.isEmpty()) {
if (!this.client.getHabbo().hasPermission(Permission.ACC_CHAT_NO_FILTER)) {
@ -117,7 +117,7 @@ public class CommandBotEvent extends MessageHandler {
String name = this.packet.readString();
boolean invalidName = name.length() > BotManager.MAXIMUM_NAME_LENGTH || name.contains("<") || name.contains(">");
if (!invalidName) {
String filteredName = Emulator.getGameEnvironment().getWordFilter().filter(name, null);
String filteredName = Emulator.getGameEnvironment().getWordFilter().filter(name, this.client.getHabbo());
invalidName = !name.equalsIgnoreCase(filteredName);
if (!invalidName) {
BotSavedNameEvent nameEvent = new BotSavedNameEvent(bot, name);