Class CommandNode
java.lang.Object
top.magstar.framework.commands.CommandNode
-
Constructor Summary
ConstructorsConstructorDescriptionCommandNode(String name, Method method, Object handler, MagstarCommandRegister annotation) CommandNode(String name, Method method, Object handler, MagstarSubCommand annotation) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(CommandNode child) 添加子节点boolean查找子节点(忽略大小写)String[]获取所有子节点的名称和别名获取所有祖先节点获取所有子节点的名称(不包括别名)intgetDepth()计算当前节点在命令树中的深度获取所有后代节点获取完整的命令路径getMatchingAllChildNames(String prefix) 获取所有匹配前缀的子命令名称和别名(忽略大小写)getMatchingChildNames(String prefix) 获取所有匹配前缀的子命令名称(忽略大小写)intintgetName()getUsage()boolean检查是否有子节点inthashCode()booleanisLeaf()检查是否是叶子节点(没有子节点)booleanbooleanbooleanisRoot()检查是否是根节点booleanvoidremoveChild(CommandNode child) 移除子节点toString()
-
Constructor Details
-
CommandNode
-
CommandNode
-
-
Method Details
-
addChild
-
findChild
查找子节点(忽略大小写)- Parameters:
name- 子节点名称或别名- Returns:
- 找到的子节点,如果不存在则返回null
-
getMatchingChildNames
-
getMatchingAllChildNames
-
removeChild
-
hasChildren
public boolean hasChildren()检查是否有子节点- Returns:
- 如果有子节点返回true
-
getChildNames
-
getAllChildNames
-
getFullPath
-
getDepth
public int getDepth()计算当前节点在命令树中的深度- Returns:
- 深度值,根节点为0
-
isRoot
public boolean isRoot()检查是否是根节点- Returns:
- 如果是根节点返回true
-
isLeaf
public boolean isLeaf()检查是否是叶子节点(没有子节点)- Returns:
- 如果是叶子节点返回true
-
getAncestors
-
getDescendants
-
isMainCommand
public boolean isMainCommand() -
isSubCommand
public boolean isSubCommand() -
getPermission
-
isPlayerOnly
public boolean isPlayerOnly() -
getMinArgs
public int getMinArgs() -
getMaxArgs
public int getMaxArgs() -
getUsage
-
getDescription
-
getName
-
getAliases
-
getMethod
-
getHandler
-
getChildren
-
getParent
-
getSubCommandAnnotation
-
getMainCommandAnnotation
-
toString
-
equals
-
hashCode
-