From 4a334fb563693594317bd38b276e682918a135e7 Mon Sep 17 00:00:00 2001 From: Ilany Date: Mon, 21 Sep 2020 15:41:51 +0200 Subject: [PATCH 1/2] Fixed vendingmachines NPE --- .../items/interactions/InteractionVendingMachine.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java index 4fdd0eb1..ca0175a2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java @@ -34,8 +34,12 @@ public class InteractionVendingMachine extends HabboItem { } public THashSet getActivatorTiles(Room room) { - THashSet tiles = new THashSet(); - tiles.add(getSquareInFront(room.getLayout(), this)); + THashSet tiles = new THashSet<>(); + RoomTile tileInFront = getSquareInFront(room.getLayout(), this); + + if (tileInFront != null) + tiles.add(tileInFront); + tiles.add(room.getLayout().getTile(this.getX(), this.getY())); return tiles; } From 947d7a4ce7775e2c7f2b35a1bad417ededfa90bb Mon Sep 17 00:00:00 2001 From: Mikkel Friis Date: Tue, 22 Sep 2020 04:31:38 +0200 Subject: [PATCH 2/2] cleaned up wordfilter --- .../habbo/habbohotel/modtool/WordFilter.java | 27 +++++-------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java b/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java index 791d12d5..07cbadab 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/WordFilter.java @@ -138,29 +138,14 @@ public class WordFilter { filteredMessage = this.normalise(filteredMessage); } - TObjectHashIterator iterator = this.words.iterator(); - - boolean foundShit = false; - - while (iterator.hasNext()) { - WordFilterWord word = (WordFilterWord) iterator.next(); - - if (StringUtils.containsIgnoreCase(filteredMessage, word.key)) { - if (habbo != null) { - if (Emulator.getPluginManager().fireEvent(new UserTriggerWordFilterEvent(habbo, word)).isCancelled()) - continue; - } - filteredMessage = filteredMessage.replace("(?i)" + word.key, word.replacement); - foundShit = true; - - if (habbo != null && word.muteTime > 0) { - habbo.mute(word.muteTime, false); - } + for (WordFilterWord word : this.words) { + if (!StringUtils.containsIgnoreCase(filteredMessage, word.key)) continue; + if (habbo != null) { + if (Emulator.getPluginManager().fireEvent(new UserTriggerWordFilterEvent(habbo, word)).isCancelled()) + continue; } - } - if (!foundShit) { - return message; + filteredMessage = filteredMessage.replaceAll("(?i)" + Pattern.quote(word.key), word.replacement); } return filteredMessage;