Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Chat Ignorers

Matej edited this page Jul 16, 2019 · 4 revisions

Chat ignorer is a very unlucky name for a function that let players decide whether they want to see certain rules (e.g. swears). Let's say you want to allow the players to decide whether they will see the following words: 'fuck' and 'asshole'.

1) Create rules for those swear words, assigned to a handler named 'swear' for convenience. Place rules in rules.txt file.

match fuck
handle as swear

match asshole
handle as swear

2) Now, create an appropriate handler in handlers.yml

swear:
  Bypass_With_Permission: "chatcontrol.bypass.swear"    
  Player_Warn_Message: "&cSwearing is prohibited on this server."
  Ignore_Chatdisplay: swears

The interesting part is 'Ignore_Chatdisplay', we'll get to it later.

3) Enable chat ignorer functionality in settings.yml and create an example chat ignorer named 'swears' (the one that is used above).

Chat_Ignorer:
  Enabled: true
  Sets:
    swears:
      Ignored_By_Default: false

Chat_Ignorer.Sets.swears: The name of the ignorer. This is simply the name of the filter that players will use in-game. The section name is important, as it is used further in handlers.txt in step #3 or can also be used in rules with 'ignore chatdisplay swears' operator.

Ignored_By_Default: This option determines whether to display or hide all rules that has assigned this ignorer by default. On false, players will see swearing unless they manually hide it using a command.

4) Let's test in-game, giving the player 'chatcontrol.commands.ignore' and 'chatcontrol.ignoreset.swears' permissions.

Player 1 tries to write one of the three words in the game chat. Player 2 has not done anything so far, and since the option 'Ignored_By_Default' is to false (as above), he will see the swear.

Player 2 so executes following command: '/chc ignore swears'. A message appears informing him that the messages from 'swear' ignore set are now hidden.

Player 1 swears again. He will see his own message since he has not done anything, but player 2 won't be able to see the swear (unless he executes the command above again or server restarts).

Clone this wiki locally