@Test public void testMessageFromFriendsChatIsFiltered() { when(client.isFriended("B0aty", false)).thenReturn(false); when(chatFilterConfig.filterFriendsChat()).thenReturn(true); assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("B0aty")); }
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);  }