• 欢迎来到Minecraft插件百科!
  • 对百科编辑一脸懵逼?帮助:快速入门带您快速熟悉百科编辑!
  • 因近日遭受攻击,百科现已限制编辑,有意编辑请加入插件百科企鹅群:223812289

ChatControl Pro/WIKI/处理器

来自Minecraft插件百科
Qsefthuopq讨论 | 贡献2019年1月26日 (六) 18:39的版本 (创建页面,内容为“处理器可在规则捕获到内容后执行一组行为. 一个处理器包含关于应该触发什么的多个指令,并且可以从每个规则重定向. =…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索

处理器可在规则捕获到内容后执行一组行为. 一个处理器包含关于应该触发什么的多个指令,并且可以从每个规则重定向.

什么是处理器

当你添加了很多规则后,你可能会发现你的规则会重复阻拦一些消息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

How to Use Handlers

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.

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

介绍: If the player has the specified permission their message will no be checked/handled.

Bypass_With_Permission: 'chatcontrol.bypass.ad'

Ignore_Commands

介绍: If you specify this, the handler will only function on the commands in the list.

  Only_In_Commands:
    - /register
    - /reg
    - /login
    - /l


Ignore_Usernames

介绍: Shall we ignore the names of the players online? Can degrade performance slightly on extremely big servers.

Ignore_Usernames: true

Ignore_Chatdisplay

介绍: 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

介绍: A list of worlds on which this handler will be ineffective.

Ignore_Worlds: [ignored_world, ignored_world_nether, another_world]

Player_Warn_Message

介绍: 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

介绍: 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

介绍: 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

介绍: 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

介绍: A path to file where the message will be logged. Set to 'none' to disable.

Write_To_File: log/advertisements.log

Block_Message

介绍: Should the message be completely blocked from appearing?

Block_Message: true

Fine

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

Fine: 15

Sound

介绍: Sound to play. Format: , ,

Sound: ENTITY_ARROW_HIT_PLAYER, 1.0, 0.1

Warn_Points

介绍: 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

介绍: 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

介绍: 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

介绍: 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

介绍: Commands to be executed as the player.

Execute_Player_Commands:
  - kill

Execute_Bungee_Commands

介绍: 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}!