/blimit 指令
基本信息
| 属性 | 值 |
|---|---|
| 实现类 | com.github.namikon.blocklimiter.command.BlockLimiterCommand |
| 接口 | net.minecraft.command.ICommand |
| 命令名 | blimit |
| 别名 | blimit |
| 注册时机 | BlockLimiter.serverLoad(FMLServerStartingEvent) 时调用 registerServerCommand |
| 可执行者 | canCommandSenderUseCommand 始终返回 true;reload 子命令额外校验 OP 身份 |
命令格式
/blimit <reload|blockinfo|iteminfo>
无参数或参数未知时返回:
Usage: /blimit reload|blockinfo|iteminfo
子命令
reload
-
权限:OP 或单人模式的 LAN 主。
-
行为:调用
BlockLimiter.Config.Reload():- 重新
_mainConfig.load()配置文件。 - 调用
Init()重新读取所有配置字段。 - 调用
InitDefinedBlocks()与InitDefinedItems()重建禁用集合。
- 重新
-
成功反馈:
Blocklimiter config reloaded. Now monitoring: - <N> Block(s) - <N> Item(s)
-
失败反馈:
Blocks could not be reloaded properly. Please check the console output and fix the config file
非 OP 时:
You need to be op or admin to reload the config
blockinfo
- 权限:所有玩家可用(不需要 OP)。
- 行为:列出
BlockLimiter.Config.LimitedBlocks的内容;每条通过BlockInfo.getInfoString()格式化输出:- 全局禁用:
Block <modID>:<blockname> [ALL] - 维度禁用:
Block <modID>:<blockname> [In DIM: <dim1>, <dim2>, ...]
- 全局禁用:
- 空列表时输出
There are currently no forbidden Blocks。
iteminfo
- 权限:所有玩家可用。
- 行为:列出
BlockLimiter.Config.LimitedItems的内容;格式与blockinfo一致,但Block前缀改为Item。 - 空列表时输出
There are currently no forbidden Items。
OP 判定逻辑
isOpOrAdmin(ICommandSender):
- 服务端为集成模式(
!isDedicatedServer())时直接返回true(单人/LAN 主玩家)。 - 命令发送者为
EntityPlayerMP时,调用MinecraftServer.getServer().getConfigurationManager().func_152596_g(tEP.getGameProfile())(即原版 OP 列表查询)。
数值
| 数值 | 默认值 |
|---|---|
| 命令别名 | blimit |
| Tab 补全 | 未实现(addTabCompletionOptions 返回 null) |
限制
- 命令通过
ICommand(旧式ICommandSender接口)实现,与现代CommandBase接口不同;可能与其他 mod 的命令框架发生冲突。 tab自动补全关闭,使用时需手动输入子命令。compareTo(Object)直接返回0,即不参与命令排序。ProcessDenyinDims方法体为空——这是代码中保留的 stub,没有实际功能。
相关条目
- BlockLimiter 配置 -
/blimit reload重新加载的配置文件 - 方块放置限制 -
blockinfo列出的条目由该机制执行 - 物品使用限制 -
iteminfo列出的条目由该机制执行