Package cn.nukkit.command
Interface CommandMap
- All Known Implementing Classes:
SimpleCommandMap
public interface CommandMap
- Author:
- MagicDroidX (Nukkit Project)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
清理全部的插件命令default boolean
dispatch
(CommandSender sender, String cmdLine) Deprecated.int
executeCommand
(CommandSender sender, String cmdLine) 执行命令getCommand
(String name) 从给定命令名称或者别名获取命令对象boolean
注册命令boolean
注册命令void
registerAll
(String fallbackPrefix, List<? extends Command> commands) 注册全部命令void
registerSimpleCommands
(Object object) 注册一个基于注解开发的命令
-
Method Details
-
registerAll
注册全部命令- Parameters:
fallbackPrefix
- 命令标签前缀,当命令label重复时用于区分commands
- the commands
-
register
注册命令- Parameters:
fallbackPrefix
- 命令标签前缀,当命令label重复时用于区分command
- the command- Returns:
- 当命令label重复时返回false, 此时你无法使用label来获取和执行命令,不过你仍然可以使用fallbackPrefix:label来获取命令
-
register
注册命令- Parameters:
fallbackPrefix
- 命令标签前缀,当命令label重复时用于区分command
- the commandlabel
- the label- Returns:
- the boolean
-
registerSimpleCommands
注册一个基于注解开发的命令- Parameters:
object
- the object
-
dispatch
@Deprecated @DeprecationDetails(since="1.19.60-r1", reason="use CommandMap#executeCommand") default boolean dispatch(CommandSender sender, String cmdLine) Deprecated.执行命令- Parameters:
sender
- the sendercmdLine
- the cmd line- Returns:
- the int
-
executeCommand
执行命令- 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
void clearCommands()清理全部的插件命令 -
getCommand
从给定命令名称或者别名获取命令对象- Parameters:
name
- the name- Returns:
- the command
-