服务器使用量
未统计
服务玩家数
未统计
下载量
4,189
插件详细介绍
CBlocker 是一款用于拦截自定义命令的 Spigot 插件,支持英语与德语,并提供 GUI、日志、API、Command-Watcher 等功能。以下为整理后的中文说明。
插件简介
- 本插件提供两种语言:
- german
- english
- 已超过 1000 次下载,感谢支持。
- BIG UPDATE:
- 请查看 change log
- 详细内容见下方说明
- 作者希望将插件翻译成更多语言。
- 如果你完成了翻译,请发送已上传文件的链接给作者。
- NEW: CBlocker-GUI
McStats可用于查看本插件的使用情况。- 本插件使用 Spigot
1.9.4编译,但说明中提到它也应兼容更早版本。 - 你可以配合作者的
ToolPack解锁更多功能,但这不是插件正常运行所必需的。 - 如果你发现任何 bug,请联系作者。
功能特性
- 拦截用户自定义命令
- 支持
blacklist与whitelist模式 - 支持自定义语言与消息
- 支持 TabComplete
- 支持日志记录
- 支持 Metrics
- 提供 API
- 支持多种拦截方式
- 支持
Command-Watcher - 提供
CBlocker GUI - 支持命令替换
- 支持确认执行机制
- 支持 Actionbar、Title、Subtitle 提示
开发状态
- 已提供 / 已加入:
- new directory system added
- new config system added
- language/messages can be changed
- tab complete added
- new commands added
- metrics added
- logging added
- API added (will be changed maybe)
- new blocking features
- Command-Watcher
- CBlocker GUI
- 当前仍在开发中:
- bug fixing
- searching for new ideas
- 当前已知 bug:
- no bugs
- 如果你发现 bug,请通过讨论区、邮件或私信反馈给作者。
命令与权限
主命令
- 主命令:
/cb - 全部权限:
cb.* - 全部权限别名:
cb.admin
子命令
/cb reload- 重新加载
config.yml - 权限:
cb.admin.reload
/cb list- 列出
commands.yml中的所有命令
/cb help- 显示帮助页面
/cb check [cmd]- 检查一个命令是否可用
- 别名:
/cb isblocked [cmd]
/cb info- 显示插件信息
/cb mode (newMode)- 显示当前模式,或切换到指定模式
- 可在
config.yml中禁用 - 权限:
cb.admin.mode
/cb disable- 永久禁用 CBlocker
- 需要在
config.yml中重新启用,并在重启或 reload 后生效 - 不会删除你的数据
- 可在
config.yml中禁用 - 权限:
cb.admin.disable
/cbgui- 打开 CBlocker GUI
- 别名:
- 文档中出现了 `/cblockergui`- 英文页面中也出现了 `/cbblockergui`- 权限:
cb.gui
/cb add [cmd] [args]- 向
commands.yml添加命令 - 可在
config.yml中禁用 - 权限:
cb.admin.add
/cb remove [cmd]- 从列表中移除命令
- 可在
config.yml中禁用 - 权限:
cb.admin.remove
/cw- 开启或关闭 Command-Watcher
- 可在
config.yml中禁用 - 权限:
cwatcher.user
`/cb add` 用法
基本格式
[cmd]- 要拦截的命令
- 示例:
"/deop" /非常重要,必须写上
[args]- 可用于定义附加属性
可用参数
player : ProGamer- 仅对指定玩家拦截该命令
world : world_nether- 仅在指定世界拦截该命令
op_override : false- 连 OP 也无法绕过该拦截
perm : your.permission- 设置绕过权限,拥有该权限的玩家可执行命令
confirm : your message with spaces- 为该命令设置确认消息
- 玩家需通过
/confirm确认执行
replace : replacecommand- 当命令被拦截时,改为执行另一个命令
msg : your message with spaces- 设置拦截消息
actionbar : your actionbar message with spaces- 设置显示在 Actionbar 的拦截提示
title : your title- 设置拦截时显示的 Title
- 建议保持简短,否则可能显示不完整
subtitle : your subtitle- 设置 Subtitle
- 只有在定义了
title时才会显示 - 同样建议保持简短
示例
- 输入:
/cb add /gamemode world: world_the_end perm: pass.end.gamemode
- 在
commands.yml中会类似写成:
cmd(number):
name: gamemode
world: world_the_end
perm: pass.end.gamemode
op_override: true重要说明
- 编辑
commands.yml时,建议在服务器关闭状态下进行。 commands.yml中的命令数量上限需要正确设置,否则可能导致部分命令不生效或报错。- 语言文件名与
config.yml中的language值区分大小写。
配置文件:`config.yml`
默认配置说明
#for detailed information, visit spigotmc.org: https://www.spigotmc.org/resources/command-blocker.11052/
#do not change this entry:
version: 3
#you can disable the command-blocker completely > set enabled to false
enabled: true
#message will be shown as default if a command is blocked
message: '&7[ &4&lC&cBlocker&7] &4 Command blocked.'
#blacklist or whitelist
mode: blacklist
#language for messages; default: en
#create your own: > language: yx < + > CommandBlocker/lang/lang_yx.yml
language: en
#set to true > metrics will be enabled
metrics: true
#confirmation timeout in seconds. default: 30 seconds
timeout: 30
#you can change the prefix for command response here; color code character: &
prefix: '&7[ &4&lC&cBlocker&7] &r'
#security: protect your server by disabling commands
#true > command is enabled
#false > command is disabled
#IMPORTANT: this settings does not (!) effect the permissions
protect:
commands:
enable:
add: true
remove: true
mode: false
disable: false
#enabling tab complete for everybody or for players with the userdefined permission
tab_complete:
enable: true
permission:
enable: false
perm: here.your.permission
#security for the CBlockerAPI. You can disable functions to protect your server
api:
enabled: true
allowRead: true
allowWrite: false
allowReload: false
enableEvents: true
#you can enable/disable logging or some parts of it
#console_msg is independent of logging.enabled (!)
logging:
enabled: false
log_blocked: true
log_not_blocked: false
log_core: false
log_console: true
log_api: true
low_space: true
console_msg: true
#core settings
#sensitivity: LOW, MED, HIGH
core:
sensitivity: MED
updateChecker: true
#CommandWatcher settings, for watching players and their commands
commandWatcher:
enabled: true
message: '&7[ &8CBWatcher&7] &a&player&7 executed: >&a&cmd&7< in world >&a&world&7<'
messageBlocked: '&7[ &8CBWatcher&7] &a&player&7 tried to execute: >&a&cmd&7< in world >&a&world&7<'
ignore:
players:
- Player1
- AdminPlayer
- Example
cmds:
- help
- home
- cb
#commands.yml extra settings, for titles and subtitles of blocked/whitelisted commands
#in_seconds = false --> 20 = 1 sec
cmd:
titles:
fade_in: 20
stay: 60
fade_out: 20
in_seconds: false`sensitivity` 说明
LOW- 命令必须与定义内容完全一致
MED- 基础比较方式
HIGH- 只需相似即可匹配
配置文件:`commands.yml`
默认示例
#maximum of commands;
#you can change it, but it has to be more than the real count of the defined blocked commands.
#the old <blockedCMDs> has been removed.
#it is more comfortable to set a maximum than setting everytime adding new commands the count
max: 10
cmd1:
name: deop
world: world
opOverride: true
cmd2:
name: op
world: world
opOverride: true每条命令可用选项
cmd[number]:
name: stop
# required
world: world
# optional: set a world
player: Juyas
# optional: define a player
msg: '&4Command blocked'
# optional: define a different message than the default.
op_override: false
# important: sets if an op can pass this blocked. if it is set to false, op can't override it.
perm: your.permission.here
# optional: define a passthrough permission, every player with this permission will be able to execute this command
replace: restart
# optional: if a player executed the command /stop, he actually won't execute /stop -> he will execute /restart
confirm: Your confirm message here
# optional: command will be executed if the player executed /confirm before. he has 30 seconds to type /confirm字段说明
name- 必填
- 要拦截的命令名
world- 可选
- 指定世界
player- 可选
- 指定玩家
msg- 可选
- 使用独立的拦截提示消息
op_override- 重要
- 控制 OP 是否可绕过拦截
perm- 可选
- 设置绕过权限
replace- 可选
- 将被拦截命令替换为其它命令执行
confirm- 可选
- 需要玩家先使用
/confirm才能继续执行
语言文件
- 语言文件位于
lang文件夹中。 - 你可以直接修改现有语言文件右侧的文本内容。
- 也可以复制一份语言文件,并重命名为:
lang_yourLanguage.yml- 然后在
config.yml中设置:
language: yourLanguage- 注意:区分大小写。
- 作者目前正在寻找法语等常用语言的翻译者。
- 如果你能将
lang_en.yml翻译为其他语言,可以发送给作者,作者会公开提供给其他用户使用。
已提供的语言文件
lang_en.ymllang_de.yml
`lang_en.yml` 中包含的键
help_infohelp_helphelp_reloadhelp_checkhelp_check_aliashelp_addhelp_removehelp_modehelp_disableloadedreload_completeblocked_listunavailableavailablecommand_availablewrong_argsblacklistwhitelistcommand_blockedthe_word_isno_blockedall_blockedavailable_commandscommand_listclick_to_executedo_not_clickblocked_serverblocked_worldblocked_youblocked_no_reasonfree_serverfree_worldfree_youthe_word_reasonno_permscommand_disabledc_add_errorc_add_successc_add_existsc_remove_errorc_remove_successc_remove_existsmode_actualmode_changeddisabledconfirm_alreadyconfirmconfirm_time_overno_confirmcheck_will_replacecheck_need_confirmcwatcher_enabledcwatcher_disablednothinggui_main_settingsgui_main_commandsgui_main_logsgui_settingsgui_commandsgui_edit_cmdgui_logsgui_desc_settingsgui_desc_commandsgui_desc_logsgui_nextpagegui_prevpagegui_go_to_pagegui_edit_cmd_removegui_edit_cmd_remove_descgui_edit_cmd_toggle_opgui_click_to_editgui_no_access
权限列表
cb.*- 等同于
cb.admin - CBlocker 全部权限
cb.cmd- 允许执行
/cb相关命令
cb.admin.update- 可查看可用更新
cb.admin.edit- 包含
cb.admin.add与cb.admin.remove
cb.admin.add- 当
/cb add启用时,可添加命令到列表
cb.admin.remove- 当
/cb remove启用时,可从列表移除命令
cb.admin.reload- 允许重新加载 CBlocker
cb.admin.disable- 当
/cb disable启用时,可完全禁用 CBlocker
cb.admin.mode- 当
/cb mode启用时,可修改模式
cb.gui- 可通过
/cbgui打开 GUI
cb.gui.cmd- 可访问 CBlocker GUI 的命令列表页面
cb.gui.settings- 可访问 CBlocker GUI 的设置页面
cb.gui.log- 可访问 CBlocker GUI 的日志历史页面
cb.gui.editcmd- 可在 GUI 命令列表中编辑命令
- 若没有
cb.gui.cmd,此权限基本没有意义
API
基本用法
- API 类名为:
CBlockerAPI - 建议先声明一个 API 对象:
static CBlockerAPI api;- 然后先检查 API 是否启用,再创建对象:
if (CBlockerAPI.enabled())
{
//plugin should be an instance of your JavaPlugin-mainclass
api = new CBlockerAPI(plugin);
}API FAQ
- 创建 API 对象时报错:
- 请确认你没有重复创建 API 实例
- 每个插件只应创建一次
- 调用 API 方法时报错:
- 请确认你拥有对应访问权限
- 相关权限可在 CBlocker 的配置中修改
- 你可以通过以下方法检查:
//if you have created an CBlockerAPI object named "api"
if(api.canRead())
{
//you have reading access
}
if(api.canWrite())
{
//you have writing access
}
if(api.canReload())
{
//you can reload cblocker
}
if(api.eventsEnabled())
{
//cblocker will use events
}API 方法
static boolean enabled()Plugin getPlugin()boolean isEnabled()boolean canRead()boolean canWrite()boolean canReload()boolean eventsEnabled()boolean isBlocked(Player p, String command)boolean isBlocked(Player p, World w, String command)CBlockReason getBlockReason(Player p, String command)CBlockReason getBlockReason(Player p, World w, String command)Vector<CCommand> getBlocked()Vector<CCommand> getBlocked(String command)CCommand getBlocked(int number)String getReasonMessage(CBlockReason reason)String getBlockMessage(int number)String getConfirmMessage(int number)String getMessage(String key)String getMessage(int number)boolean containsCommand(int number)boolean containsCommand(String command)Vector<String> getBlockeMessages(String command)boolean addRuntimeBlocked(CCommand command)boolean removeRuntimeBlocked(int number)CLanguage getLanguage()Mode getMode()boolean toolPackUsage()boolean reloadCBlocker()void log(String line)CConfig getConfig()boolean reloadConfig()CVersion getCBlockerVersion()boolean isCompatible( CVersion needed)boolean hasNewUpdate()
附加类与枚举
enum ModeBlacklistWhitelist
enum CSensitivityLOWMEDIUMHIGH
enum CBlockReasonFREE_PERM (-4)FREE_PLAYER (-3)FREE_WORLD (-2)FREE (-1)NOT_BLOCKED (0)BLOCKED (1)WORLD_BLOCKED (2)PLAYER_BLOCKED (3)PERM_NEEDED (4)int getID()boolean isBlocked()static CBlockReason blockReason(int ID)
`CCommand` 方法
boolean hasPlayer()boolean hasWorld()boolean hasPermission()boolean hasMessage()boolean opOverride()boolean hasReplacement()boolean needConfirm()String name()World world()UUID worldUUID()OfflinePlayer offlinePlayer()Player player()UUID playerUUID()String permission()String message()int number()String replacement()String confirm()HashMap<String, String> values()boolean equals(CCommand bc)static CCommand getInstance(String command, OfflinePlayer player, World world, String message, String permission, boolean opOverride, String replacement, String confirm)
`CConfig`(只读)
boolean metricsint versionString prefixboolean caddboolean cremoveboolean cmodeboolean cableboolean tabEnabledboolean tabPermsString tabPermboolean loggingboolean logBlockedboolean logNotBlockedboolean logCoreboolean logAPIboolean logLowSpaceboolean logConsoleboolean consoleMessagesCSensitivity sensitivity
其他类
class CLanguageString getLanguage()File getLanguageFile()boolean exists()
class CVersionstatic CVersion getVersion( String version)String toString()int compareTo(CVersion version)
API 异常
AccessDeniedException- 当无权限访问时抛出
- 如已启用日志,也可能被记录
AlreadyRegisteredException- 当你尝试创建多个 API 实例时抛出
APIDisabledExcepion- 当 API 被禁用时访问会抛出
PluginNotRegisteredException- 当插件未注册就尝试访问 API 时抛出
- 创建新的
CBlockerAPI对象时会自动注册插件
API 事件
ApiAccessEvent- 当某个插件访问 API 时触发
- 方法:
- `Plugin getPlugin()`- `Access getAccess()`- `boolean wasAllowed()`CommandBlockedEvent- 当命令被拦截后触发
- 方法:
- `String getMessage()`- `CCommand getCommand()`- `Player getExecutor()`- `CBlockReason getReason()`CommandReplacedEvent- 当命令被替换后触发
- 方法:
- `CBlockReason getReason()`- `String getReplacement()`- `Player getExecutor()`- `CCommand getCommand()`PostConfirmationProcessedEvent- 当确认流程完成后触发
- 方法:
- `String getConfirmMessage()`- `Player getExecutor()`- `CCommand getCommand()`PreCommandBlockedEvent- 在命令因任意原因即将被拦截前触发
- 方法:
- `boolean willReplace()`- `String getReplacement()`- `void setReplacement(String replacement)`- `boolean needConfirm()`- `String getConfirmMessage()`- `void setConfirmation(String message)`- `World getWorld()`- `String getMessage()`- `CBlockReason getReason()`- `void setMessage(String message)`- `void setCancelled(boolean cancel)`- `boolean isCancelled()`常见问题
- 支持哪些语言?
- 当前文档说明支持:
- german- english- 是否必须使用
ToolPack? - 不是必须。
- 仅用于解锁更多功能或附加内容。
/cb disable会删除数据吗?- 不会。
- 文档明确说明不会破坏现有数据。
- 可以自定义拦截提示吗?
- 可以。
- 支持
msg、actionbar、title、subtitle、confirm等。
- 可以限制到指定玩家或指定世界吗?
- 可以。
- 使用
player与world参数即可。
- 可以让某些玩家绕过拦截吗?
- 可以。
- 使用
perm设置绕过权限。
- OP 能否绕过拦截?
- 由
op_override控制。
旧版信息页
- 文档中还包含旧版信息页,适用于
0.3.2.0及更低版本。 - 其中使用了旧配置结构,例如:
block_messageblockedCMDslanguageblacklist: true- 旧版还提到:
- AddOn available:
- `WorldGuardFreeRegion`- recommended: `C Blocker 1.0.0.5`- min: `1.0.0.4b`- 作者还计划制作两个教程视频:
- basic usage and configuration
- advanced usage and API
- 视频将先提供德语版本,英语版稍后推出。
测试支持版本
版本分布
基本信息
插件名称
CBlocker Universal
作者
Juyas
平台
Bukkit / Spigot
支持版本
1.8 - 1.10
点赞数
1
最近版本
暂无数据
-