Per Player Censor (PPC)

Discussion in 'Archived: Plugin Requests' started by smackman17, Jan 3, 2014.

  1. Offline

    smackman17

    Plugin name: Per Player Censor (PPC)

    What it would do: it would allow players to censor certain words on a blacklist that they make for themselves, but others can choose to see the word.

    An example: player 1 doesn't want to see people's swears, so he/she can type a command and the censor would turn on his/her censor, but player 2 doesn't mind swearing, so he/she doesn't have to have their censor on.

    Commands:
    /pcc enable - turns on the censor for the player
    /pcc disable - turns off the censor for that player
    /pcc on - same as /pcc enable
    /pcc off - same as /pcc disable
    /pcc add - adds a word to the player's word blacklist
    /pcc remove - removes a word from the player's word blacklist

    Permissions:
    pcc.use - let's player turn on/off censor
    pcc.add - lets players add words to their blacklist
    pcc.remove - lets players remove words from their blacklist

    Config:
    Character - symbol the censored word is blocked by (example: if '*' was entered in this section, the word would look like '****')

    When I would like it by: whenever it can be made.
     
  2. Offline

    TrenTech

    You would have to loop through each player on the server to do this which could cause some lag for larger server.
     
  3. Offline

    TheKomputerKing

    No it wouldn't. The amount of lag this would cause is minuscule even on a big server. It's just a for loop and they use hardly any resources.
     
    WarmakerT likes this.
  4. Offline

    JRL1004

    TrenTech may be right. You can't just monitor the AsyncPlayerChatEvent and remove them as a recipient, you will need to take the message and edit it on a per-player basis then send out the message to the player. This will also need to be compatible with other plugins like essentials too (Which monitor the event for URLs/ color codes/etc). Despite how simple it seems, this plugin could prove to be a fair challenge.
     
  5. Offline

    TheKomputerKing

    JRL1004

    It's simple.

    Set EventPriority to lowest and then:

    event.setCancelled(true);
    for (Player p : Bukkit.getOnlinePlayers()){
    if (pShouldSeeSwearing){
    p.sendMessage(message);
    } else {
    p.sendMessage(filteredMessage);
    }
    }

    Pseudocode, but would work.
     
  6. Offline

    TrenTech

    Again that for loop will end up running almost every tick on a busy server, plus there's more to it than that. for one the words players don't want to see will have to be stored somewhere and parsed per player, either on demand or stored in memory. now the amount a memory it takes to store a variable is minuscule however it'll begin to add up the more players utilize it and add words. Plus as JRL1004 stated you'll want it to be essentials compatible considering almost every server uses it which will require more checks per player. now doing all this on one or 2 players if fine but every player on the server on every sent chat message is a little much for something so small.
     
  7. Offline

    AndyMcB1

    Then how do big companies like Runespace work out their swearing filter for 2000 odd people without lag.
     
    timtower likes this.
  8. Offline

    TrenTech

    Never heard of them, don't know thier infrastructure so I can't answer that.
     

Share This Page