@Test public void testMessageFromFriendIsNotFiltered() { when(client.isFriended("Iron Mammal", false)).thenReturn(true); when(chatFilterConfig.filterFriends()).thenReturn(false); assertFalse(chatFilterPlugin.shouldFilterPlayerMessage("Iron Mammal")); }
boolean shouldFilterPlayerMessage(String playerName) { boolean isMessageFromSelf = playerName.equals(client.getLocalPlayer().getName()); return !isMessageFromSelf && (config.filterFriends() || !client.isFriended(playerName, false)) && (config.filterFriendsChat() || !friendChatManager.isMember(playerName)); }
ChatFilterPlugin extends Plugin { boolean shouldFilterPlayerMessage(String playerName) { boolean isMessageFromSelf = playerName.equals(client.getLocalPlayer().getName()); return !isMessageFromSelf && (config.filterFriends() || !client.isFriended(playerName, false)) && (config.filterFriendsChat() || !friendChatManager.isMember(playerName)); } }
ChatFilterPlugin extends Plugin { boolean shouldFilterPlayerMessage(String playerName) { boolean isMessageFromSelf = playerName.equals(client.getLocalPlayer().getName()); return !isMessageFromSelf && (config.filterFriends() || !client.isFriended(playerName, false)) && (config.filterFriendsChat() || !friendChatManager.isMember(playerName)); }  }
ChatFilterPlugin extends Plugin { boolean shouldFilterPlayerMessage(String playerName) { boolean isMessageFromSelf = playerName.equals(client.getLocalPlayer().getName()); return !isMessageFromSelf && (config.filterFriends() || !client.isFriended(playerName, false)) && (config.filterFriendsChat() || !friendChatManager.isMember(playerName)); }  @Subscribe void onScriptCallbackEvent(ScriptCallbackEvent event); @Subscribe void onOverheadTextChanged(OverheadTextChanged event); @Subscribe(priority = -2) // run after ChatMessageManager void onChatMessage(ChatMessage chatMessage); @Subscribe void onConfigChanged(ConfigChanged event); }
ChatFilterPlugin extends Plugin { boolean shouldFilterPlayerMessage(String playerName) { boolean isMessageFromSelf = playerName.equals(client.getLocalPlayer().getName()); return !isMessageFromSelf && (config.filterFriends() || !client.isFriended(playerName, false)) && (config.filterFriendsChat() || !friendChatManager.isMember(playerName)); }  @Subscribe void onScriptCallbackEvent(ScriptCallbackEvent event); @Subscribe void onOverheadTextChanged(OverheadTextChanged event); @Subscribe(priority = -2) // run after ChatMessageManager void onChatMessage(ChatMessage chatMessage); @Subscribe void onConfigChanged(ConfigChanged event);  }