Project:Sandbox

Handlers are groups of actions executed when a rule is caught. One handler contain multiple instructions about what should happen, and can be redirected to from each rule.

= Why Handlers = ChatControl Pro is designed to be as clean and user-friendly as possible. With time, as you decide to add more and more rules, you may find yourself repeating blocks of code multiple times (see 1.0). This repetition works well until you need to change something. Handlers make it possible to "group" those actions into a single handler, which rules can call easily (see 1.1).

1.0 Rules without handlers: match fuck then warn &cYour message has been blocked. then actionbar &cPlease do not swear on this server! then notify chatcontrol.notify.swear {player} has sworn: {message} then replace ***** match bitch then warn &cYour message has been blocked. then actionbar &cPlease do not swear on this server! then notify chatcontrol.notify.swear {player} has sworn: {message} then replace ***** match asshole then warn &cYour message has been blocked. then actionbar &cPlease do not swear on this server! then notify chatcontrol.notify.swear {player} has sworn: {message} then replace ***** 1.1 Rules with handlers:

= How to Use Handlers = To assert a handler to a rule, write  (replace {handler} with the name of the handler from handlers.yml) to the final line of the rule. You can still use all operators inside of the rule, but they will be overwritten by those specified in the handler.

= Configuring Handlers = In handlers.yml, you can just create new handlers or remove the ones you don't need. Below you will find all possible settings. To save space, you only need to specify those that you want to use.

Bypass_With_Permission
Info: If the player has the specified permission their message will no be checked/handled. Bypass_With_Permission: 'chatcontrol.bypass.ad'

Ignore_Commands
Info: If you specify this, the handler will only function on the commands in the list. Only_In_Commands: - /register - /reg - /login - /l

Ignore_Usernames
Info: Shall we ignore the names of the players online? Can degrade performance slightly on extremely big servers. Ignore_Usernames: true

Ignore_Chatdisplay
Info: If chat ignorer is enabled and a handler catches the message, players who ignore the specified set won't see the message. Enter the name of the chat ignorer set Ignore_Chatdisplay: swear

Ignore_Worlds
Info: A list of worlds on which this handler will be ineffective. Ignore_Worlds: [ignored_world, ignored_world_nether, another_world]

Player_Warn_Message
Info: A message displayed to the player. Set to 'none' to disable.

Accepts: Either write the entire message or specify a formatter name from formatting.yml Player_Warn_Message: "{prefix} &cSorry, {player}, advertising is prohibited!"

Broadcast_Message
Info: A message broadcasted to everyone. Set to 'none' to disable.

Accepts: Either write the entire message or specify a formatter name from formatting.yml Broadcast_Message: "{server} &6{player} tried to &cadvertise&6, inform OP!"

Staff_Alert
Info: A message broadcasted to players with permission specified below. The {ruleID} variable, if used, will be replaced only if the rule specifies an ID.

Format: Specify the permission + the actual message divided by a whitespace " " (see below).

Accepts: For the actual message, either write the entire message or specify a formatter name from formatting.yml Staff_Alert: "chatcontrol.notify.advertise {prefix} &c{player} violated rule &6ID {ruleID} &cwith: &f{message}"

Console_Message
Info: A message logged into console. Set to 'none' to disable. The {handler} variable is the name of the handler. Console_Message: "{player} violated rule ID {ruleID}, triggered {handler} filter with: {message}"

Write_To_File
Info: A path to file where the message will be logged. Set to 'none' to disable. Write_To_File: log/advertisements.log

Block_Message
Info: Should the message be completely blocked from appearing? Block_Message: true

Fine
Info: When plugin Vault is installed, you can take money from player. Specify the amount as a whole number. Fine: 15

Sound
Info: Sound to play. Format:, , Sound: ENTITY_ARROW_HIT_PLAYER, 1.0, 0.1

Warn_Points
Info: If points system is enabled (settings.yml), the amount of warning points to be given. Warn_Points: swear 1 It is possible to specify the warning set name. NOTICE: If you have global warning set, and want to give points there, you do not need to specify the set name Warn_Points: swear 1

Replace_Word
Info: A replacement that replaces only the part of the message that matched the rule. If set, Block_Message must be false and "Rewrite_To" must not be set. Separate by | to choose randomly from several strings. Replace_Word: "[CENSORED]" Tip:: Start the message with @prolong and only specify one letter to automatically stretch the replacement to match the word's length. Replace_Word: "@prolong *"

Rewrite_To
Info: A replacement that replaces the whole message. If set, Block_Message must be false and "Replace_Word" must not be set. Separate by | to choose randomly from several strings. Rewrite_To: I love this filter!|This server is amazing!|I can't take it!

Execute_Commands
Info: A list of commands to be executed as the console. Notice: They are not handled by this plugin. Execute_Commands: - eco take {player} 10 - kick {player} &cDo not advertise! - tempban {player} 1d Advertising is prohibited! \n\nContact OP if you think this is in error. \n\nMessage caught: {message}

Execute_Player_Commands
Info: Commands to be executed as the player. Execute_Player_Commands: - kill

Execute_Bungee_Commands
Info: A list of commands to be executed on Bungee. You need to have bungee support enabled in settings.yml and an additional plugin on bungee. Execute_Bungee_Commands: - alert The {player} has violated a rule on {server}!