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

Difference between revisions of "ChatControl Pro/WIKI/处理器"

From Minecraft插件百科
Jump to: navigation, search
(创建页面,内容为“处理器可在规则捕获到内容后执行一组行为. 一个处理器包含关于应该触发什么的多个指令,并且可以从每个规则重定向. =…”)
 
m (Replace_Word)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{{模板:Ccpbox}}
 
处理器可在规则捕获到内容后执行一组行为. 一个处理器包含关于应该触发什么的多个指令,并且可以从每个规则重定向.
 
处理器可在规则捕获到内容后执行一组行为. 一个处理器包含关于应该触发什么的多个指令,并且可以从每个规则重定向.
  
 
= 什么是处理器 =
 
= 什么是处理器 =
当你添加了很多规则后,你可能会发现你的规则会重复阻拦一些消息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:''
+
''1.0 无需处理器的规则:''
 
  match fuck
 
  match fuck
  then warn &cYour message has been blocked.
+
  then warn &c禁止粗鄙之语.
  then actionbar &cPlease do not swear on this server!
+
  then actionbar &c请勿使用粗鄙之语!
  then notify chatcontrol.notify.swear {player} has sworn: {message}
+
  then notify chatcontrol.notify.swear {player} 说出了脏话: {message}
 
  then replace *****
 
  then replace *****
 
   
 
   
 
  match bitch
 
  match bitch
  then warn &cYour message has been blocked.
+
  then warn &c禁止粗鄙之语.
  then actionbar &cPlease do not swear on this server!
+
  then actionbar &c请勿使用粗鄙之语!
  then notify chatcontrol.notify.swear {player} has sworn: {message}
+
  then notify chatcontrol.notify.swear {player} 说出了脏话: {message}
 
  then replace *****
 
  then replace *****
 
   
 
   
 
  match asshole
 
  match asshole
  then warn &cYour message has been blocked.
+
  then warn &c禁止粗鄙之语.
  then actionbar &cPlease do not swear on this server!
+
  then actionbar &c请勿使用粗鄙之语!
  then notify chatcontrol.notify.swear {player} has sworn: {message}
+
  then notify chatcontrol.notify.swear {player} 说出了脏话: {message}
 
  then replace *****
 
  then replace *****
''1.1 Rules with handlers:''
+
''1.1 使用处理器的规则:''
 
  <code>match fuck
 
  <code>match fuck
 
  handle as swear
 
  handle as swear
Line 32: Line 33:
 
  handle as swear</code>
 
  handle as swear</code>
  
= How to Use Handlers =
+
= 如何使用处理器 =
To assert a handler to a rule, write <code>handle as {handler}</code> (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.
+
想要声明一个处理器用于一个规则, 请在规则的最后一行输入代码 <code>handle as {handler}</code> (替换 {handler} handlers.yml内获取的处理器名). 你仍然可以在规则内使用所有的运算符,但这些运算符可能会被特定的处理器覆盖.
  
= 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.
+
在handlers.yml里,你可以创建或移除处理器. 以下为可用设置. 为了节约空间,你只需指定你想要使用的处理器.
  
 
== Bypass_With_Permission ==
 
== Bypass_With_Permission ==
介绍: If the player has the specified permission their message will no be checked/handled.
+
介绍: 如果玩家拥有指定权限则不会被检测/处理.
 
  Bypass_With_Permission: 'chatcontrol.bypass.ad'
 
  Bypass_With_Permission: 'chatcontrol.bypass.ad'
  
Line 45: Line 46:
  
  
介绍: If you specify this, the handler will only function on the commands in the list.
+
介绍: 忽略列表内的指令.
 
   Only_In_Commands:
 
   Only_In_Commands:
 
     - /register
 
     - /register
Line 54: Line 55:
  
 
== Ignore_Usernames ==
 
== Ignore_Usernames ==
介绍: Shall we ignore the names of the players online? Can degrade performance slightly on extremely big servers.
+
介绍: 是否忽略在线的玩家名?  
 
  Ignore_Usernames: true
 
  Ignore_Usernames: true
  
 
== Ignore_Chatdisplay ==
 
== 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_Chatdisplay: swear
 
<br />
 
<br />
  
 
== Ignore_Worlds ==
 
== Ignore_Worlds ==
介绍: A list of worlds on which this handler will be ineffective.
+
介绍: 不检测的世界.
 
  Ignore_Worlds: [ignored_world, ignored_world_nether, another_world]
 
  Ignore_Worlds: [ignored_world, ignored_world_nether, another_world]
  
 
== Player_Warn_Message ==
 
== Player_Warn_Message ==
介绍: A message displayed to the player. Set to 'none' to disable.
+
介绍: 发送给玩家的警告信息. 设置为none关闭
  
Accepts: Either write the entire message or specify a formatter name from formatting.yml
+
可用: 输入整条消息或指定formatting.yml内的格式名
  Player_Warn_Message: "{prefix} &cSorry, {player}, advertising is prohibited!"
+
  Player_Warn_Message: "{prefix} &c抱歉, {player}, 禁止打广告!"
  
 
== Broadcast_Message ==
 
== Broadcast_Message ==
介绍: A message broadcasted to everyone. Set to 'none' to disable.
+
介绍: 广播消息. 设置为none关闭
  
Accepts: Either write the entire message or specify a formatter name from formatting.yml
+
可用: 输入整条消息或指定formatting.yml内的格式名
  Broadcast_Message: "{server} &6{player} tried to &cadvertise&6, inform OP!"
+
  Broadcast_Message: "{server} &6{player} 尝试&c打广告&6!"
  
 
== Staff_Alert ==
 
== 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.
+
介绍:播放给有指定权限的玩家.{ruleID}变量为规则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
+
可用: 输入整条消息或指定formatting.yml内的格式名
 
  Staff_Alert: "chatcontrol.notify.advertise {prefix} &c{player} violated rule &6ID {ruleID} &cwith: &f{message}"
 
  Staff_Alert: "chatcontrol.notify.advertise {prefix} &c{player} violated rule &6ID {ruleID} &cwith: &f{message}"
  
 
== Console_Message ==
 
== Console_Message ==
介绍: A message logged into console. Set to 'none' to disable. The {handler} variable is the name of the handler.
+
介绍:记录到控制台的消息.设置为none关闭. {handler}为处理器变量.
  Console_Message: "{player} violated rule ID {ruleID}, triggered {handler} filter with: {message}"
+
  Console_Message: "{player} 违反了ID为{ruleID}的规则,触发{handler}过滤器: {message}"
  
 
== Write_To_File ==
 
== Write_To_File ==
介绍: A path to file where the message will be logged. Set to 'none' to disable.
+
介绍: 记录消息的文件路径. 设置为'none' 关闭.
 
  Write_To_File: log/advertisements.log
 
  Write_To_File: log/advertisements.log
  
 
== Block_Message ==
 
== Block_Message ==
介绍: Should the message be completely blocked from appearing?
+
介绍: 是否阻止消息的发送?
 
  Block_Message: true
 
  Block_Message: true
  
== Fine ==
+
== 罚款 ==
介绍: When plugin Vault is installed, you can take money from player. Specify the amount as a whole number.
+
介绍: 安装了Vault后从玩家身上罚款.必须为整数
 
  Fine: 15
 
  Fine: 15
  
== Sound ==
+
== 音效 ==
介绍: Sound to play. Format: , ,
+
介绍: 播放的音效.
 
  Sound: ENTITY_ARROW_HIT_PLAYER, 1.0, 0.1
 
  Sound: ENTITY_ARROW_HIT_PLAYER, 1.0, 0.1
  
 
== Warn_Points ==
 
== Warn_Points ==
介绍: If points system is enabled (settings.yml), the amount of warning points to be given.
+
介绍: 如果启用了警告系统 (settings.yml),给予多少警告分数.
 
  Warn_Points: swear 1
 
  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
 
  Warn_Points: swear 1
  
 
== Replace_Word ==
 
== 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.
+
介绍:替换匹配规则的消息部分. 如果设置了这个,必须关闭 Block_Message 且不能设置 "Rewrite_To". | 分隔.
 
  Replace_Word: "[CENSORED]"
 
  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.
+
提醒::@prolong开头并且只指定一个字母会自动延伸至匹配消息的长度.
 
  Replace_Word: "@prolong *"
 
  Replace_Word: "@prolong *"
  
 
== Rewrite_To ==
 
== 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.
+
介绍: 替换整条消息. 如果设置了这个,你必须关闭 Block_Message ,不能设置"Replace_Word" . | 分隔.
  Rewrite_To: I love this filter!|This server is amazing!|I can't take it!
+
  Rewrite_To: 我喜欢这个服务器!|服务器真好玩!
  
 
== Execute_Commands ==
 
== Execute_Commands ==
介绍: A list of commands to be executed as the console. Notice: They are not handled by this plugin.
+
介绍: 以控制台身份执行的指令列表. 提醒: 可使用其他插件的指令.
 
  Execute_Commands:
 
  Execute_Commands:
 
   - eco take {player} 10
 
   - eco take {player} 10
   - kick {player} &cDo not advertise!
+
   - kick {player} &c不要打广告!
   - tempban {player} 1d Advertising is prohibited! \n\nContact OP if you think this is in error. \n\nMessage caught: {message}
+
   - tempban {player} 1d 禁止打广告! \n\n如果是误判请联系管理员. \n\n捕获到的消息: {message}
  
 
== Execute_Player_Commands ==
 
== Execute_Player_Commands ==
介绍: Commands to be executed as the player.
+
介绍: 以玩家身份执行的指令.
 
  Execute_Player_Commands:
 
  Execute_Player_Commands:
 
   - kill
 
   - kill
  
 
== Execute_Bungee_Commands ==
 
== 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.
+
介绍:在Bungee执行的指令. 你必须在配置内启用bungee兼容并在BungeeCord安装[[BungeeControlBridge]].
 
  Execute_Bungee_Commands:
 
  Execute_Bungee_Commands:
   - alert The {player} has violated a rule on {server}!
+
   - alert 玩家 {player} {server} 违反了规则!

Latest revision as of 16:50, 29 January 2019

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

什么是处理器

当你添加了很多规则后,你可能会发现你的规则会重复阻拦一些消息. 当你添加了很多规则后. 这些重复内容需要你删除重复的代码才能去除.使用处理器可以把这些行为分到一个组内来使规则更容易执行.

1.0 无需处理器的规则:

match fuck
then warn &c禁止粗鄙之语.
then actionbar &c请勿使用粗鄙之语!
then notify chatcontrol.notify.swear {player} 说出了脏话: {message}
then replace *****

match bitch
then warn &c禁止粗鄙之语.
then actionbar &c请勿使用粗鄙之语!
then notify chatcontrol.notify.swear {player} 说出了脏话: {message}
then replace *****

match asshole
then warn &c禁止粗鄙之语.
then actionbar &c请勿使用粗鄙之语!
then notify chatcontrol.notify.swear {player} 说出了脏话: {message}
then replace *****

1.1 使用处理器的规则:

match fuck
handle as swear

match bitch
handle as swear

match asshole
handle as swear

如何使用处理器

想要声明一个处理器用于一个规则, 请在规则的最后一行输入代码 handle as {handler} (替换 {handler} handlers.yml内获取的处理器名). 你仍然可以在规则内使用所有的运算符,但这些运算符可能会被特定的处理器覆盖.

配置处理器

在handlers.yml里,你可以创建或移除处理器. 以下为可用设置. 为了节约空间,你只需指定你想要使用的处理器.

Bypass_With_Permission

介绍: 如果玩家拥有指定权限则不会被检测/处理.

Bypass_With_Permission: 'chatcontrol.bypass.ad'

Ignore_Commands

介绍: 忽略列表内的指令.

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


Ignore_Usernames

介绍: 是否忽略在线的玩家名?

Ignore_Usernames: true

Ignore_Chatdisplay

介绍: 如果启用了聊天忽略器并且处理器捕获到消息, 忽略组合的玩家不会看到消息. 在此输入聊天忽略器组合名

Ignore_Chatdisplay: swear


Ignore_Worlds

介绍: 不检测的世界.

Ignore_Worlds: [ignored_world, ignored_world_nether, another_world]

Player_Warn_Message

介绍: 发送给玩家的警告信息. 设置为none关闭

可用: 输入整条消息或指定formatting.yml内的格式名

Player_Warn_Message: "{prefix} &c抱歉, {player}, 禁止打广告!"

Broadcast_Message

介绍: 广播消息. 设置为none关闭

可用: 输入整条消息或指定formatting.yml内的格式名

Broadcast_Message: "{server} &6{player} 尝试&c打广告&6!"

Staff_Alert

介绍:播放给有指定权限的玩家.{ruleID}变量为规则ID.

格式: 指定权限 + 消息,可用空格分隔 " " (查看下面的示例).

可用: 输入整条消息或指定formatting.yml内的格式名

Staff_Alert: "chatcontrol.notify.advertise {prefix} &c{player} violated rule &6ID {ruleID} &cwith: &f{message}"

Console_Message

介绍:记录到控制台的消息.设置为none关闭. {handler}为处理器变量.

Console_Message: "{player} 违反了ID为{ruleID}的规则,触发{handler}过滤器: {message}"

Write_To_File

介绍: 记录消息的文件路径. 设置为'none' 关闭.

Write_To_File: log/advertisements.log

Block_Message

介绍: 是否阻止消息的发送?

Block_Message: true

罚款

介绍: 安装了Vault后从玩家身上罚款.必须为整数

Fine: 15

音效

介绍: 播放的音效.

Sound: ENTITY_ARROW_HIT_PLAYER, 1.0, 0.1

Warn_Points

介绍: 如果启用了警告系统 (settings.yml),给予多少警告分数.

Warn_Points: swear 1

可以指定警告组合名. 提醒: 如果你设置了全服警告组合, 并想要在这里给予警告分数,你不需要指定组合名

Warn_Points: swear 1

Replace_Word

介绍:替换匹配规则的消息部分. 如果设置了这个,必须关闭 Block_Message 且不能设置 "Rewrite_To". 用| 分隔.

Replace_Word: "[CENSORED]"

提醒::用@prolong开头并且只指定一个字母会自动延伸至匹配消息的长度.

Replace_Word: "@prolong *"

Rewrite_To

介绍: 替换整条消息. 如果设置了这个,你必须关闭 Block_Message ,不能设置"Replace_Word" . 用| 分隔.

Rewrite_To: 我喜欢这个服务器!|服务器真好玩!

Execute_Commands

介绍: 以控制台身份执行的指令列表. 提醒: 可使用其他插件的指令.

Execute_Commands:
  - eco take {player} 10
  - kick {player} &c不要打广告!
  - tempban {player} 1d 禁止打广告! \n\n如果是误判请联系管理员. \n\n捕获到的消息: {message}

Execute_Player_Commands

介绍: 以玩家身份执行的指令.

Execute_Player_Commands:
  - kill

Execute_Bungee_Commands

介绍:在Bungee执行的指令. 你必须在配置内启用bungee兼容并在BungeeCord安装BungeeControlBridge.

Execute_Bungee_Commands:
  - alert 玩家 {player} 在 {server} 违反了规则!