Package cn.nukkit.command
Class SimpleCommandMap
java.lang.Object
cn.nukkit.command.SimpleCommandMap
- All Implemented Interfaces:
CommandMap
- Author:
- MagicDroidX (Nukkit Project)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
清理全部的插件命令int
executeCommand
(CommandSender sender, String cmdLine) 执行命令getCommand
(String name) 从给定命令名称或者别名获取命令对象获取knownCommands
的未克隆实例parseArguments
(String cmdLine) 解析给定文本,从中分割参数boolean
注册命令boolean
注册命令void
registerAll
(String fallbackPrefix, List<? extends Command> commands) 注册全部命令void
注册插件在plugin.yml中定义的命令别名void
registerSimpleCommands
(Object object) 注册一个基于注解开发的命令Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface cn.nukkit.command.CommandMap
dispatch
-
Field Details
-
knownCommands
-
-
Constructor Details
-
SimpleCommandMap
-
-
Method Details
-
registerAll
Description copied from interface:CommandMap
注册全部命令- Specified by:
registerAll
in interfaceCommandMap
- Parameters:
fallbackPrefix
- 命令标签前缀,当命令label重复时用于区分commands
- the commands
-
register
Description copied from interface:CommandMap
注册命令- Specified by:
register
in interfaceCommandMap
- Parameters:
fallbackPrefix
- 命令标签前缀,当命令label重复时用于区分command
- the command- Returns:
- 当命令label重复时返回false, 此时你无法使用label来获取和执行命令,不过你仍然可以使用fallbackPrefix:label来获取命令
-
register
Description copied from interface:CommandMap
注册命令- Specified by:
register
in interfaceCommandMap
- Parameters:
fallbackPrefix
- 命令标签前缀,当命令label重复时用于区分command
- the commandlabel
- the label- Returns:
- the boolean
-
registerSimpleCommands
Description copied from interface:CommandMap
注册一个基于注解开发的命令- Specified by:
registerSimpleCommands
in interfaceCommandMap
- Parameters:
object
- the object
-
parseArguments
解析给定文本,从中分割参数- Parameters:
cmdLine
- the cmd line- Returns:
- 参数数组
-
executeCommand
Description copied from interface:CommandMap
执行命令- Specified by:
executeCommand
in interfaceCommandMap
- Parameters:
sender
- the sendercmdLine
- the cmd line- Returns:
- the int 返回0代表执行失败, 返回大于等于1代表执行成功
Returns 0 for failed execution, greater than or equal to 1 for successful execution
-
clearCommands
public void clearCommands()Description copied from interface:CommandMap
清理全部的插件命令- Specified by:
clearCommands
in interfaceCommandMap
-
getCommand
Description copied from interface:CommandMap
从给定命令名称或者别名获取命令对象- Specified by:
getCommand
in interfaceCommandMap
- Parameters:
name
- the name- Returns:
- the command
-
getCommands
获取knownCommands
的未克隆实例- Returns:
- the commands
-
registerServerAliases
public void registerServerAliases()注册插件在plugin.yml中定义的命令别名
-