AntiSwear easily bypassed

Discussion in 'Spigot Plugin Development' started by UnlimitedNinjas, Jul 2, 2018.

  1. how do i make this antiswear more advanced, like its so easy to bypass it just capitalize any letter or add a . or anything and it wont detect, also it doesnt replace the word with ****
    Code (Text):
        @EventHandler
        public void onChat(AsyncPlayerChatEvent e) {
            for (String word : e.getMessage().split(" ")) {
                if (getConfig().getStringList("swearwords").contains(word)) {
                    if (getConfig().getBoolean("antiswear", true)) {
                        e.getMessage().replace(word, "****");
                        e.getPlayer().sendMessage(ChatColor.RED + "Please do not swear!");
                }
            }
        }
    }
     
     
  2. .contains();
    .toLowerCase();

    These might not be the exact methods.
     
    • Agree Agree x 2
  3. Check how other plugin work, he fund method to know if word match at x% (getting each word per char and make some math ;) )

    There are plent of other method to do it, so check plugin and wiki / doc / pseudo code, @BillyGalbreath good wiki link ^^

    there also exist table like for bruteforce with swear word writted in different ways