响应事件
Shell React 监控服务器和玩家的常规事件,并据此运行特定的 shell 程序或脚本。音频警报高度可配置,且每个事件的警报可以不同。最初设计用于在玩家加入私有服务器时触发带宽的释放。它可以可靠地检测到“空闲”的服务器状态,从而触发相应的外部脚本将带宽重定向到其他用途。该概念拥有众多应用场景,潜力仅受限于你的想象力。
自定义命令
快速定义能够访问玩家、控制台甚至主机操作系统的安全命令。自定义命令具有多种可定义的覆盖能力。现有的命令可以被动态重新映射以执行其他操作。你可以定义能够调用其他命令的新命令,包括自定义消息、音频输出和参数控制。
Bukkit 集成
ShellReact 将 Bukkit 服务器集成到其主机操作系统中。可以使用标准的操作系统功能来控制 Bukkit 服务器,而 Bukkit 服务器也可以使用这些相同的标准功能来指导其运行的主机。
热加载处理
按照设计,你可以在在线运行的服务器上实施更改。配置文件 'config.yml' 是用户界面,也是始终如一的主参考文件。ShellReact 永远不会修改此文件,它仅在收到命令时从中更新。例如,在 'config.yml' 中添加一个新命令,然后在控制台或作为玩家输入 /sr,瞧!它就生效了。功能可以随时开启或关闭。服务器构建者或管理员可以拥有专用的 'config.yml' 库,这些库可以复制到 ShellReact 目录并立即调用。
YAML 验证
从版本 2.5 开始,ShellReact 会预扫描其 YAML 配置文件,并且仅在其有效时才会从中更新。如果无效,则会报告语法错误以及所在的行/列位置。配合这一新增强健壮性的是自动重载功能:当检测到配置文件有任何更改时,ShellReact 会自动重载。预扫描使得这使用安全。该功能是可选的,默认处于关闭状态。
双向交互
版本 2.5 还新增了与主机操作系统的双向交互功能。这是通过使用两者共用的底层文件系统来实现的。可以使用主机操作系统的计划任务或 cron 来触发正在运行的 Bukkit 服务器上的已定义过程。从任何可以访问 ShellReact 目录的地方发送信号以重启、停止服务器或保存全部数据等。我个人最喜欢的是当服务器运行时出现在桌面上的停止和重启按钮,而在服务器停止时它们会消失。
结构化方法
在 ShellReact 中定义的命令触发器和响应非常结构化且具有自文档特性。这使得在不迷失方向的情况下基于现有工作进行扩展变得容易。随用随进,在坚实的基础上构建。
更新是可选的
Shell React 目前支持 Microsoft 和 Linux 操作系统,并在可用时充分利用集成的主题音频。它是一个真正的 Bukkit 插件,仅通过 Bukkit API 获取对 Minecraft 的访问权限。这使 Shell React 免于任何版本限制要求。将只有一个版本 :-) 它完全用 Java 编写,旨在成为一个稳健的插件,简单好用且让人忘记它的存在。本描述的其余部分将是 'config.yml' 文件,因为它旨在实现自文档化。
注意:我已将此标记为适用于 146 和 147 版本,但它应该也适用于早期版本的 Bukkit。我只是还没有测试过它们。
示例
CONFIG.YML
# Shell React, a Bukkit plugin
ShellReact will use Vault for permissions if it is installed,
otherwise it defaults to Bukkit permissions.
This is a light weight plugin that endeavors to use only the
resources it needs to implement what is defined in this file.
There is also no limit on numbered definitions, discretion is
left to the user.
ShellReact is a system level configuration utility designed to
facilitate automatic responses to specified events. An event may
be originated by the Bukkit server, the host OS or a user/player.
Two way communication with the host OS makes it possible for
server builders to control the Bukkit server using the underlying
file system, common to both. Customizable audio alerts on the
server may be defined. General access to defined player commands
may be secured by op status, permission status, or even to a
specific player. Ops are given access to the configuration
environment by default, but ops don't always have file system
access. This provides a system level basis of security, by design.
Use /shellreact or /sr to reload config.yml at any time, both
player and console. Or use the auto reload feature in 'Settings'
and ShellReact will automatically reload whenever changes are
made to 'config.yml'. ShellReact never modifies config.yml, this
file is always the master. ShellReact only uses 'config.yml' on
startup or when reloading. All configuration details are retained
in memory arrays. On reload, all memory arrays are rebuilt and
'config.yml' is released. Everything setup here is designed to
be added and modified hot, without disturbing the server.
Permission node 'shellreact.admin' is required to use the
/shellreact command if the Allow_op_shellreact flag under settings
below is set to 'false'.
DON'T USE TABS, PERIOD. Follow standard YAML rules and formatting.
'config.yml' is validated when loaded or reloaded. A syntax error
will be concisely displayed along with the row/column. This
validation is done before using the yaml file allowing ShellReact
to routinely abort the process, leaving the existing config intact.
此文件中的每个可配置项都有一个“Active”标志,
旨在方便根据需要动态开启或关闭触发器。因此,
未始终保持激活状态的触发器的详细信息在非活动状态下仍可保留完整。
每个单独的设置都有合理的默认值,如果未使用或默认值合适,则可以省略。字符串设置通常默认为 'none',布尔值通常默认为 'false'。无效的设置将恢复为其默认值。
玩家和服务器的冷却时间决定了在最终确定服务器空闲状态之前等待的时间长度。这为遭受 TCP 问题的玩家提供了缓冲,并防止了不必要的玩家退出处理。
'Platform'(平台)可以是:'Auto'、'Windows'、'Linux' 或 'Custom'(自定义)。
'Custom'(自定义)除了命令本身外,还需要定义由 'Shell_cmd' 指定的 shell 和 shell 参数。即:
Shell_cmd: CMD, /C, batch.cmd parm1 parm2 等
使用逗号分隔 shell、shell 参数和命令。
Settings:
Platform : Auto
Allow_op_shellreact : true
Auto_reload : false
Quiet : false
Debug : false
Player_quit_cool : 10
Server_vacant_cool : 20
当 'Auto_reload' 设置为 'true' 时,ShellReact 会在检测到 'Config.yml' 发生更改时自动重新加载它。
将 'Quiet' 设置为 'true' 以关闭所有 ShellReact 消息,仅保留自定义的 'Message_out' 字符串和错误消息。
当 'Debug' 设置为 true 时,将在控制台显示你的 shell 命令的输出。
对于 Windows 平台,建议对 shell 命令使用标准反斜杠而不是正斜杠,但两者应该都可以。
FQN(完全限定名称)示例:
Shell_cmd: C:\parent_dir\child_dir\batch_file.cmd parm1 %player%
UNC(通用命名约定)示例:
Shell_cmd: \Computer\parent_dir\child_dir\program.exe %player%
可以使用平台友好的 'beep' 警报设置音频提醒。
单独的 'beep' 将发出单个控制台蜂鸣声。'beep.5' 将发出 5 次控制台蜂鸣声。'beep.3.300' 将发出 3 次控制台蜂鸣声,间隔 300 毫秒。格式为:beep.[次数].[延迟]
也可以使用标准的 Windows 主题警报。见底部。
在 Windows 中,任何音频都可以使用控制面板/声音连接到任何主题标识符。
'Console_cmd'、'Player_cmd' 和 'Sreact_cmd' 接受用逗号分隔的多个命令。'Shell_cmd' 不需要这样做。
命令处理器接受多条命令,或者,你也可以将所有变量传递给脚本或批处理文件,然后做任何你想做的事,完全独立于 Bukkit 和 Minecraft。隔离,但知情 :-) 例如:
Shell_cmd: SCRIPT.CMD %parameters% %player% %player_ip%
%player_count% %location%
%world% %X% %Y% %Z%
变量 (区分大小写)
%parameters% 运行时输入的参数
%player% 加入或退出的玩家
%player_ip% 玩家的 tcp/ip 地址 '0.0.0.0'
%player_count% 在线玩家数量
%location% 玩家位置,格式为:'world x y z'
%world% 玩家所在的世界位置
%X% 玩家 X 坐标位置
%Y% 玩家 Y 坐标位置
%Z% 玩家 Z 坐标位置
指令 (区分大小写)
'_ ' 下划线后跟一个空格,称为行锚点。用于标记每行的字符串定义开头。消除了平衡引号的需求。有助于多行字符串定义。在运行时被剥离,包括空格。保留它与该行字符串定义起始之间的空白。
_nl 在消息输出中表示换行
_runtime 用于下面 Commands 部分中的 'Default_params' 设置。用于标记该命令使用参数,但未定义默认参数。
'Message_out' 是与玩家命令关联时发送给玩家的自定义消息,否则发送给控制台。使用标准的 '&x' 格式化。变量会被展开。不包含 ShellReact 前缀。在你的字符串中使用 'nl' 来表示换行。如果你的字符串以格式化字符开头,你必须以 ' ' 开头。它将在运行时被剥离。例如:
Message_out: _ &cExample string starting with the line anchor.
行锚点也将保留空白。
使用 Active 'false' 使整个事件处于非活动状态。
使用 'none' 使某个详情未被使用。
***************************************************************
服务器触发器
***************************************************************
Player_join:
Active : false
Message_out : none
Shell_cmd : none
Console_cmd : none
Sreact_cmd : none
Audio_alert : none
Player_quit:
Active : false
Message_out : none
Shell_cmd : none
Console_cmd : none
Sreact_cmd : none
Audio_alert : none
玩家加入和退出的示例。取消注释并替换上面的内容以使用。
按玩家记录日志,存储在名为 'PlayerLogs' 的目录中,位于你的 Bukkit 目录下。你可以随意定制它,或者用于其他用途。
Linux 用户需要更改 shell 命令以适应他们的需求。
#Player_join:
Active : true
Message_out : none
Shell_cmd : _ MD .\PlayerLogs &
_ ECHO %date% %time% JOINED from %player_ip% at
_ %location% with %player_count% players online.
_ >> .\PlayerLogs%player%.log
Console_cmd : none
Audio_alert : beep
#Player_quit:
Active : true
Message_out : none
Shell_cmd : _ ECHO %date% %time% QUIT from %player_ip% at
_ %location% with %player_count% players online.
_ >> .\PlayerLogs%player%.log
Console_cmd : none
Audio_alert : beep.2.500
Server_vacant:
Active : false
Message_out : none
Shell_cmd : none
Console_cmd : none
Sreact_cmd : none
Audio_alert : none
#Server_vacant:
Active : true
Message_out : All changes flushed to disk.
Shell_cmd : none
Console_cmd : save-all
Audio_alert : win.sound.exit
Server_start:
Active : false
Message_out : none
Shell_cmd : none
Console_cmd : none
Sreact_cmd : none
Audio_alert : none
Server_stop:
Active : false
Message_out : none
Shell_cmd : none
Console_cmd : none
Sreact_cmd : none
Audio_alert : none
***************************************************************
以下所有部分均为编号序列列表,
从 0(零)开始,依次递增。正确的顺序是强制性的。内置数量没有限制。
序列号 0 包含每个部分的所有可用设置及其默认值。
可以使用序列 0,但最好将其保留为参考,并保持非激活状态。
无需为每个序列包含所有定义名称。只需包含未使用默认值的定义即可。
***************************************************************
文件触发器。这些是由文件名定义的布尔触发器。
使用此功能从主机操作系统向 ShellReact 发送信号。
当在 ShellReact 目录中找到由 'File_name' 定义的文件名时,即会触发。
该文件会被自动删除,以防止意外递归。
***************************************************************
主机操作系统标志(从 0 开始,依次递增)
***************************************************************
File_triggers:
0:
File_name : DEFAULT
Message_out : none
Shell_cmd : none
Console_cmd : none
Sreact_cmd : none
Audio_alert : none
Active : false
1:
File_name : Do_Restart
Message_out : Server restarted using a file trigger.
Sreact_cmd : RESTART
Active : true
2:
File_name : Do_Stop
Message_out : Server stopped using a file trigger.
Sreact_cmd : STOP
Active : true
示例 1 和 2 将向服务器发出停止或重启的信号。
它们引用下方“Commands”部分中的命令。
Windows 示例:在桌面上创建一个新的快捷方式,
并在位置处输入 'cmd /c echo %time% > path_to_ShellReact_dir\Do_Restart',
并将其命名为“RESTART”。为其指定一个漂亮的图标,
这样你就拥有了一个桌面版 Bukkit 重启按钮。
服务器可以位于网络上的任何位置。
控制台监控触发器。这些是由不区分大小写的字符串定义的触发器。
当控制台输出的行中找到 Trigger_string 时,将调用该触发器。
Trigger_string 要在控制台输出中查找的字符串
Trigger_cool 连续调用之间的最小延迟(毫秒)
***************************************************************
控制台监控触发器(从 0 开始,依次递增)
***************************************************************
Console_mon:
0:
Trigger_string : DEFAULT
Message_out : none
Shell_cmd : none
Console_cmd : none
Sreact_cmd : none
Trigger_cool : 10000
Audio_alert : none
Active : false
1:
Trigger_string : Did the system time change
Message_out : Automatic server lag response example.
Console_cmd : lag
Trigger_cool : 30000
Active : true
自定义命名命令。这些是由玩家输入的命令,
并且可以选择性地包含控制台输入。
这些也是可以从任何部分通过 'Sreact_cmd' 设置调用的命名子程序。
使用此功能配合 /shellreact 或 /sr 命令,
动态添加安全的控制台和玩家命令序列,
这些序列可以选择性地提醒控制台并触发 shell 命令。
此设计支持热配置,无需干扰服务器或正在进行的游玩过程。
虽然动作序列可能相当长,但采取的措施确保以不会干扰 Minecraft 游玩的方式调用它们。
例如;一条典型的命令将立即调用 'Player_cmd' 序列。
'Console_cmd' 和 'Sreact_cmd' 序列随后会有轻微延迟地执行。
'Shell_cmd' 和 'Audio_alert' 则在各自的线程上调用。
当 Override 设置为 false 时,此处定义的命令不会影响
其他插件或服务器中具有相同名称且名为 'Name' 的命令。
这里的响应将仅补充任何其他同名命令。
将 Override 设置为 true 将有效地创建一个主命令,
取代并替换来自其他插件的任何同名命令。
Cmd_name 玩家或控制台(触发器)输入的命令
可从任何部分调用。
Default_params 如果命令未输入参数时使用的参数
使用指令 '_runtime' 表示需要参数,但未设置默认值
Player_cmd 要运行的实时玩家命令
Override 取消并替换原始输入的命令
Include_console 设为 'true' 以包含控制台输入
权限
仅在由在线玩家调用时生效。要使某条命令对特定玩家可用,
必须满足以下条件之一。
如果未设置任何玩家权限且 'Include_console' 为 true,
则该命令仅对控制台可用。如果同样情况下 'Include_console' 为 false,则该命令
只能作为子程序被调用,由 'Sreact_cmd' 定义
Op_allow 'true' 表示响应 OP(管理员)
Perm_node 权限节点,设为 'none' 则忽略节点检查
Player_allow 指定玩家的权限,设为 'none' 则忽略玩家检查
***************************************************************
自定义输入命令(从 0 开始,依次递增)
***************************************************************
Commands:
0:
Cmd_name : DEFAULT
Default_params : none
Message_out : none
Shell_cmd : none
Console_cmd : none
Player_cmd : none
Sreact_cmd : none
Audio_alert : none
Override : false
Include_console : false
Op_allow : false
Perm_node : none
Player_allow : none
Active : false
1:
Cmd_name : RESTART
Message_out : Restarting the server...
Shell_cmd : echo %time% > .\restart
Console_cmd : save-all, stop
Audio_alert : beep.5.1000
Override : true
Include_console : true
Op_allow : true
Perm_node : group.admin
Active : true
2:
Cmd_name : STOP
Message_out : Stopping the server...
Shell_cmd : del .\restart
Console_cmd : save-all, stop
Audio_alert : beep.5.1000
Override : true
Include_console : true
Active : true
3:
Cmd_name : RULES
Default_params : be
Message_out : Example root cmd, default parameter 'be'
Sreact_cmd : rules %parameters%
Override : true
Include_console : true
Op_allow : true
Perm_node : group.players
Active : true
4:
Cmd_name : RULES no
Message_out : _ &a Server Rules (No) _nl
_ &e No Kicking _nl
_ &e No Biting _nl
_ &e No Cussing _nl
_ &e No Hair Pulling _nl
Override : true
Include_console : true
Op_allow : true
Perm_node : group.players
Active : true
5:
Name : RULES be
Message_out : _ &a Server Rules (Be) _nl
_ &e Be Nice _nl
_ &e Be Polite _nl
_ &e Be Helpful _nl
_ &e Be Constructive _nl
Override : true
Include_console : true
Op_allow : true
Perm_node : group.players
Active : true
示例服务器重启命令:要使用此功能,请取消注释上述命令 1 和 2。
在用于启动 Bukkit 服务器的批处理文件中,在 java 启动行上方添加
标签 :Restart,并在其后添加文件存在性检查。例如:
SET BINDIR=%~dp0
CD /D "%BINDIR%"
:Restart
java -server -Xmx4G -Xms4G -jar craftbukkit.jar nogui
IF EXIST restart GOTO Restart
Linux 用户;请按所示更改 shell 命令以创建/删除名为 'restart' 的文件,
并修改你的服务器启动脚本以包含该标签和文件存在性检查。
示例命令 3、4 和 5 是 'Message_out' 的格式示例。
演示了 '_ ' 行锚点和 '_nl' 换行格式化符。
它们还展示了使用相同根命令 'RULES' 的两个独立命令定义。
音频警报 ID
通用音频警报(跨平台兼容)
beep.[次数].[延迟]
次数 = 连续蜂鸣的次数,范围为 1 到 5
延迟 = 蜂鸣之间的延迟时间(毫秒),范围为 150 到 1000
Windows 主题警报
win.sound.default
win.sound.close
win.sound.maximize
win.sound.minimize
win.sound.menuCommand
win.sound.menuPopup
win.sound.open
win.sound.restoreDown
win.sound.restoreUp
win.sound.asterisk
win.sound.exclamation
win.sound.exit
win.sound.hand
win.sound.question
win.sound.start
请随意删除注释以符合您的喜好。只需重命名
您的 config.yml 并运行 /shellreact(或 /sr),即可轻松重新生成带有文档的默认
config.yml。此外,各部分的顺序或每个部分内定义的顺序没有任何规则限制。
同样,这也取决于您个人的喜好。但是,编号序列必须正确。
另外,仅当设置值不同于默认值时,才需要单独的设置名称。
通过省略未使用的设置项,可以使您的操作定义更易于阅读。
React to Events
Shell React monitors general server and player events and runs specific shell programs or scripts in response. Audio alerts are highly configurable and may be different for each event. Originally created to trigger the opening of bandwidth on a private server when players join. The server status of vacant is reliably detected which would fire the appropriate outside script redirecting the bandwidth elsewhere. The concept has many applications, limited only by one's imagination.
Custom Commands
Quickly define secure commands that have access to player, console and even the host operating system. Custom commands have many definable override capabilities. Existing commands may be re-mapped to do something else, on the fly. Define new commands capable of invoking other commands, complete with custom messages audio output and parameter control.
Bukkit Integration
ShellReact integrates a Bukkit server into its host operating system. Standard operating system facilities may be used to control a Bukkit server, and a Bukkit server may use those same, standard facilities to direct the host it runs on.
Hot Processing
Implement your changes on a live server, by design. The configuration file 'config.yml' is the user interface, and always the master reference. ShellReact never modifies this file, it only updates from it, on command. For example, add a new command in 'config.yml', enter /sr at the console, or as a player and poof! it is there. Features are turned on and off, hot. Server builders or admins may have libraries of special purpose 'config.yml's that can be copied into the ShellReact directory and instantly invoked.
YAML Validation
Starting at version 2.5, ShellReact pre-scans it's YAML configuration file and will only update from it if is valid. If it is not valid, the syntax error is reported, along with the row/column location. Complimenting this new robustness, is a new capability to automatically reload when any changes to its configuration file are detected. The pre-scan makes this safe to use. It is optional, and defaults to off.
Bidirectional
Also new with version 2.5 is bidirectional interaction with the host operating system. This is accomplished using the underlying file system, common to both. Use the Host OS scheduler or cron to trigger defined procedures on a running Bukkit server. Signal a server restart, stop, save-all, etc… from anywhere you have access to the ShellReact directory. My personal favorites are stop and restart buttons that appear on my desktop when the server is running, and disappear when it is stopped.
Structured Approach
Commands triggers and responses defined in ShellReact are very structured and self documenting. This makes it easy to build on existing work without getting lost. Evolve as you go, build on Terra firma.
Updates are Optional
Shell React supports the Microsoft and Linux operating systems right now and makes good use of the integrated, theme audio when available. It is a true Bukkit plugin gaining access to Minecraft through the Bukkit api only. This exempts Shell React from any versioning requirements. There will be only one version :-) It is written entirely in Java and is intended to be a robust plugin that simply works and gets forgotten about. The balance of this description will be the 'config.yml' file since it is intended to be self documenting.
Note: I have this flagged for 146 and 147, but it should be good for earlier versions of Bukkit. I just haven't tested them.
EXAMPLES
CONFIG.YML
# Shell React, a Bukkit plugin
ShellReact will use Vault for permissions if it is installed,
otherwise it defaults to Bukkit permissions.
This is a light weight plugin that endeavors to use only the
resources it needs to implement what is defined in this file.
There is also no limit on numbered definitions, discretion is
left to the user.
ShellReact is a system level configuration utility designed to
facilitate automatic responses to specified events. An event may
be originated by the Bukkit server, the host OS or a user/player.
Two way communication with the host OS makes it possible for
server builders to control the Bukkit server using the underlying
file system, common to both. Customizable audio alerts on the
server may be defined. General access to defined player commands
may be secured by op status, permission status, or even to a
specific player. Ops are given access to the configuration
environment by default, but ops don't always have file system
access. This provides a system level basis of security, by design.
Use /shellreact or /sr to reload config.yml at any time, both
player and console. Or use the auto reload feature in 'Settings'
and ShellReact will automatically reload whenever changes are
made to 'config.yml'. ShellReact never modifies config.yml, this
file is always the master. ShellReact only uses 'config.yml' on
startup or when reloading. All configuration details are retained
in memory arrays. On reload, all memory arrays are rebuilt and
'config.yml' is released. Everything setup here is designed to
be added and modified hot, without disturbing the server.
Permission node 'shellreact.admin' is required to use the
/shellreact command if the Allow_op_shellreact flag under settings
below is set to 'false'.
DON'T USE TABS, PERIOD. Follow standard YAML rules and formatting.
'config.yml' is validated when loaded or reloaded. A syntax error
will be concisely displayed along with the row/column. This
validation is done before using the yaml file allowing ShellReact
to routinely abort the process, leaving the existing config intact.
Every programmable detail in this file has an 'Active' flag
designed to make it convenient to turn triggers on or off as
needed, dynamically. Details of triggers not always left live
may therefore remain intact while inactive.
Every individual setting has a reasonable default value and may be
ommitted if not used, or the default value is OK. String settings
generally default to 'none', booleans generally default to 'false'.
An invalid setting will revert to it's default value.
Player and Server cool's determine how long to wait before making
a final decision on server vacant status. This makes allowances
for players struggling with tcp problems and prevents unnecessary
player quit processing.
'Platform' can be: 'Auto', 'Windows', 'Linux' or 'Custom'
'Custom' requires the shell and shell parameters in the command
defined by 'Shell_cmd' in addition to the command itself. ie:
Shell_cmd: CMD, /C, batch.cmd parm1 parm2 etc
Use commas to separate the shell, shell parameters, and command.
Settings:
Platform : Auto
Allow_op_shellreact : true
Auto_reload : false
Quiet : false
Debug : false
Player_quit_cool : 10
Server_vacant_cool : 20
ShellReact will automatically reload 'Config.yml' when it has
been changed if 'Auto_reload' is set to 'true'
Set 'Quiet' to 'true' to turn off all ShellReact messages except
custom 'Message_out' strings and error messages.
'Debug' will display the output from your shell command on the
console when set to true.
For the Windows platform it is best to stay with the standard
backslashes instead of forward slashes for shell commands, but
either should be ok.
FQN:
Shell_cmd: C:\parent_dir\child_dir\batch_file.cmd parm1 %player%
UNC:
Shell_cmd: \Computer\parent_dir\child_dir\program.exe %player%
Audio alerts may be set using the platform friendly 'beep' alert.
'beep' alone will emit a single console beep. 'beep.5' will emit
5 console beeps. 'beep.3.300' will emit 3 console beeps, 300
milliseconds apart. The format is: beep.[count].[delay]
Standard, Windows theme alerts are also available. See bottom.
In Windows, any audio may be connected to any theme identifier
using Control-Panel/Sounds.
'Console_cmd', 'Player_cmd' and 'Sreact_cmd' accept multiple
commands separated by commas. 'Shell_cmd' does not need this.
The command processor will accept multiple commands, or, you may
simply pass all your variables to a script or batch file and do
whatever you want, completely separate and isolated from Bukkit
and Minecraft. Isolated, but informed :-) ie:
Shell_cmd: SCRIPT.CMD %parameters% %player% %player_ip%
%player_count% %location%
%world% %X% %Y% %Z%
VARIABLES (Case sensitive)
%parameters% Parameters entered with at runtime
%player% The player that either joined or quit
%player_ip% The player's tc/ip address '0.0.0.0'
%player_count% The number of players online
%location% Player location in the form of: 'world x y z'
%world% Player world location
%X% Player X coordinate location
%Y% Player Y coordinate location
%Z% Player Z coordinate location
DIRECTIVES (Case sensitive)
'_ ' Underscore followed by a space, called a line
anchor. Mark the beginning of a string
definition, per line. Eliminates the need for
balanced quotes. Facilitates multi line
string definitions. Stripped at runtime
including the space. Preserves white spaces
between it and the beginning of the string
definition on that line.
_nl Represents a new line in message output
_runtime Used in the 'Default_params' setting in the
Commands' section below. Used to flag a
command as one that uses parameters, but no
default parameter is defined.
'Message_out' is a custom message to the player when associated
with a player command, otherwise to the console. Use standard
'&x' formatting. Variables are expanded. Contains no ShellReact
prefixing. Use '_nl' in your string to indicate newlines. You
must start your string with '_ ' if your string starts with a
formatting character. It will be stripped at runtime. ie:
Message_out: _ &cExample string starting with the line anchor.
The line anchor will also preserve white spaces.
Use Active 'false' to leave entire event inactive.
Use 'none' to leave a detail unused.
***************************************************************
SERVER TRIGGERS
***************************************************************
Player_join:
Active : false
Message_out : none
Shell_cmd : none
Console_cmd : none
Sreact_cmd : none
Audio_alert : none
Player_quit:
Active : false
Message_out : none
Shell_cmd : none
Console_cmd : none
Sreact_cmd : none
Audio_alert : none
EXAMPLE Player join and quit. Uncomment and replace above to use.
player log, by player in a directory named 'PlayerLogs' in your
Bukkit directory. Customize it any way you want, or use it for
something else.
Linux users need to change the shell commands to suit their needs.
#Player_join:
Active : true
Message_out : none
Shell_cmd : _ MD .\PlayerLogs &
_ ECHO %date% %time% JOINED from %player_ip% at
_ %location% with %player_count% players online.
_ >> .\PlayerLogs%player%.log
Console_cmd : none
Audio_alert : beep
#Player_quit:
Active : true
Message_out : none
Shell_cmd : _ ECHO %date% %time% QUIT from %player_ip% at
_ %location% with %player_count% players online.
_ >> .\PlayerLogs%player%.log
Console_cmd : none
Audio_alert : beep.2.500
Server_vacant:
Active : false
Message_out : none
Shell_cmd : none
Console_cmd : none
Sreact_cmd : none
Audio_alert : none
#Server_vacant:
Active : true
Message_out : All changes flushed to disk.
Shell_cmd : none
Console_cmd : save-all
Audio_alert : win.sound.exit
Server_start:
Active : false
Message_out : none
Shell_cmd : none
Console_cmd : none
Sreact_cmd : none
Audio_alert : none
Server_stop:
Active : false
Message_out : none
Shell_cmd : none
Console_cmd : none
Sreact_cmd : none
Audio_alert : none
***************************************************************
All sections below this message are lists of numberd sequences,
starting with 0 (zero), and incremented, sequentially. The
correct sequencing is mandatory. There is no built in limit
as to how many. Sequence number 0 contains all the settings
availble for each section, with the default values. Sequence 0
may be used, but it might be best to leave it as a reference,
left inactive. There is no need to include all the definition
names for each sequence. Only the definitions not using the
default values are required.
***************************************************************
File Trigger. These are boolean triggers defined by a file name.
Use this facility to signal ShellReact from the host OS.
When a file with a name defined by 'File_name' is found in the
ShellReact directory, it is triggered. The file is automatically
deleted to prevent unintentional recursion.
***************************************************************
HOST OS Flags (Start at 0, increment sequentially)
***************************************************************
File_triggers:
0:
File_name : DEFAULT
Message_out : none
Shell_cmd : none
Console_cmd : none
Sreact_cmd : none
Audio_alert : none
Active : false
1:
File_name : Do_Restart
Message_out : Server restarted using a file trigger.
Sreact_cmd : RESTART
Active : true
2:
File_name : Do_Stop
Message_out : Server stopped using a file trigger.
Sreact_cmd : STOP
Active : true
Examples 1 and 2 will signal the server to stop or restart.
They reference commands in the 'Commands' section below.
A Windows example: Create a new shortcut on your desktop and
enter 'cmd /c echo %time% > path_to_ShellReact_dir\Do_Restart'
for the location, and name it 'RESTART'. Give it a nice icon
and you have a Bukkit restart button on your desktop. The
server may be anywhere on your network.
Console monitor triggers. These are triggers defined by case
insensitive strings. The trigger is invoked when Trigger_string
is found in a line of console output.
Trigger_string The string to look for in console output
Trigger_cool Minimum delay in milliseconds between
successive invocations
***************************************************************
CONSOLE MONITOR TRIGGERS (Start at 0, increment sequentially)
***************************************************************
Console_mon:
0:
Trigger_string : DEFAULT
Message_out : none
Shell_cmd : none
Console_cmd : none
Sreact_cmd : none
Trigger_cool : 10000
Audio_alert : none
Active : false
1:
Trigger_string : Did the system time change
Message_out : Automatic server lag response example.
Console_cmd : lag
Trigger_cool : 30000
Active : true
Custom named commands. These are commands input by a player and
may, optionally, include console input. These are also named
subroutines that may be called from any section using the
'Sreact_cmd' setting.
Use this facility with the /shellreact or /sr command to
dynamically add secure console and player command sequences that
may, optionally, alert the console and trigger shell commands.
This is designed to be configured hot, with no need to disturb the
server, or play in process.
While the action sequences may potentially be lengthy, care is
taken to invoke them in a manner that will not disturb Minecraft
play. For example; a typical command will immediately invoke
'Player_cmd' sequences. 'Console_cmd' and 'Sreact_cmd' sequences
follow, slightly delayed. 'Shell_cmd' and 'Audio_alert' are
invoked on their own threads.
With Override set to false, commands defined here will not affect
the commands named with 'Name' that have the same name belonging
to other plugins or the server. Responses here will simply
supplement any other command with the same name. Setting Override
to true will, in effect, create a master command, superseding and
replacing any other command from other plugins with the same name.
Cmd_name Command entered by player, or console (trigger)
May be called from any section.
Default_params Parameters to use if none entered with command
Use directive '_runtime' to indicate that
parameters are required, but no default set
Player_cmd Live player command to run
Override Cancel and replace original command entered
Include_console 'true' to include console input
PERMISSIONS
Applies only when invoked by a live player. One of the below must
be true for a command to be available to a particular player.
If no player permissions are set and 'Include_console' is true,
the command will be available only to the console. If the same
is true and 'Include_console' is false, the command may only be
invoked as a subroutine, defined by 'Sreact_cmd'
Op_allow 'true' to respond to ops
Perm_node Permission node, 'none' ignores node
Player_allow Specific player permission, 'none' ignores player
***************************************************************
CUSTOM INPUT COMMANDS (Start at 0, increment sequentially)
***************************************************************
Commands:
0:
Cmd_name : DEFAULT
Default_params : none
Message_out : none
Shell_cmd : none
Console_cmd : none
Player_cmd : none
Sreact_cmd : none
Audio_alert : none
Override : false
Include_console : false
Op_allow : false
Perm_node : none
Player_allow : none
Active : false
1:
Cmd_name : RESTART
Message_out : Restarting the server...
Shell_cmd : echo %time% > .\restart
Console_cmd : save-all, stop
Audio_alert : beep.5.1000
Override : true
Include_console : true
Op_allow : true
Perm_node : group.admin
Active : true
2:
Cmd_name : STOP
Message_out : Stopping the server...
Shell_cmd : del .\restart
Console_cmd : save-all, stop
Audio_alert : beep.5.1000
Override : true
Include_console : true
Active : true
3:
Cmd_name : RULES
Default_params : be
Message_out : Example root cmd, default parameter 'be'
Sreact_cmd : rules %parameters%
Override : true
Include_console : true
Op_allow : true
Perm_node : group.players
Active : true
4:
Cmd_name : RULES no
Message_out : _ &a Server Rules (No) _nl
_ &e No Kicking _nl
_ &e No Biting _nl
_ &e No Cussing _nl
_ &e No Hair Pulling _nl
Override : true
Include_console : true
Op_allow : true
Perm_node : group.players
Active : true
5:
Name : RULES be
Message_out : _ &a Server Rules (Be) _nl
_ &e Be Nice _nl
_ &e Be Polite _nl
_ &e Be Helpful _nl
_ &e Be Constructive _nl
Override : true
Include_console : true
Op_allow : true
Perm_node : group.players
Active : true
EXAMPLE server RESTART command: To use, uncomment commands 1 and 2
above. In the batch file used to start the Bukkit server add the
label :Restart above the java start line, and add the file EXIST
check after. ie:
SET BINDIR=%~dp0
CD /D "%BINDIR%"
:Restart
java -server -Xmx4G -Xms4G -jar craftbukkit.jar nogui
IF EXIST restart GOTO Restart
Linux users; change the shell commands to create/delete the file
named 'restart' as shown, and modify your server start script to
include the label and file exist check.
Example commands 3, 4 and 5 are formatting examples for
'Message_out'. The '_ ' line anchor, the '_nl' new line
formatters are illustrated. They also demonstrate two separate
command definitions using the same root command 'RULES'.
AUDIO ALERT ID's
Generic Audio alert (platform friendly)
beep.[count].[delay]
count = the number of successive beeps, 1 to 5
delay = the delay between beeps in milliseconds, 150 to 1000
Windows theme alerts
win.sound.default
win.sound.close
win.sound.maximize
win.sound.minimize
win.sound.menuCommand
win.sound.menuPopup
win.sound.open
win.sound.restoreDown
win.sound.restoreUp
win.sound.asterisk
win.sound.exclamation
win.sound.exit
win.sound.hand
win.sound.question
win.sound.start
Feel free to remove comments to suit your taste. A default
config.yml with documentation is easily regenerated by renaming
your config.yml and running /shellreact (or /sr) Also, there
are no rules regarding section order, or definition order in
each section. Again, suit your own taste. The numbered
sequences must be correct, however. Also, Individual setting
names are only required when set to something other than the
default value. Keep your action definitions easier to read by
omitting settings not used.
评论 0
登录后参与评分
还没有评论,来抢沙发吧