-
Notifications
You must be signed in to change notification settings - Fork 8
Handlers
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.
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:
match fuck
handle as swear
match bitch
handle as swear
match asshole
handle as swear
To assert a handler to a rule, write handle as {handler}
(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.
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.
Info: If the player has the specified permission their message will no be checked/handled.
Bypass_With_Permission: 'chatcontrol.bypass.ad'
Info: A list of commands that will be excluded from the check. WARNING: In old ChatControl or the free version, this section is named Ignored_In_Commands.
Ignore_Commands:
- // # WorldEdit
- /register
- /reg
- /login
- /l
Info: If you specify this, the handler will only function on the commands in the list. We evaluate these messages as "starts with" so you can only ignore sub arguments as well.
Only_In_Commands:
- /register
- /reg
- /login
- /l
Info: Shall we ignore the names of the players online? Can degrade performance slightly on extremely big servers.
Ignore_Usernames: true
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
Info: If you set this option, the handler will only function in the worlds you specify.
Require_Worlds: [required_world, required_world_nether]
Info: A list of worlds on which this handler will be ineffective.
Ignore_Worlds: [ignored_world, ignored_world_nether, another_world]
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!"
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!"
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}"
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}"
Info: A path to file where the message will be logged. Set to 'none' to disable.
Write_To_File: log/advertisements.log
Info: Should the message be completely blocked from appearing?
Block_Message: true
Info: When plugin Vault is installed, you can take money from player. Specify the amount as a whole number.
Fine: 15
Info: Sound to play. Format: , ,
Sound: ENTITY_ARROW_HIT_PLAYER, 1.0, 0.1
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: 1
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 *"
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!
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}
Info: Commands to be executed as the player.
Execute_Player_Commands:
- kill
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}!
© MineAcademy | Code Unique Minecraft Plugins & Servers In 20 Days
About
Free version
Basics
Understanding
- Channels
- Formatting
- Rules / Filters
- Handlers
- Groups
- JSON
- Discord
- Toggle ignoring swears
- Variables
- JavaScript Variables
Tweaking
Solving Issues
Miscellaneous