Class HelpFilters
java.lang.Object
studio.mevera.imperat.command.tree.help.HelpFilters
Factory class providing common help filters based on
CommandPathway.-
Method Summary
Modifier and TypeMethodDescriptionstatic <S extends CommandSource>
HelpFilter<S>all()Creates a filter that always passes (includes all pathways).static <S extends CommandSource>
HelpFilter<S>allOf(HelpFilter<S>... filters) Creates a composite filter from multiple filters (AND logic).static <S extends CommandSource>
HelpFilter<S>anyOf(HelpFilter<S>... filters) Creates a composite filter from multiple filters (OR logic).static <S extends CommandSource>
@NotNull HelpFilter<S>Creates a filter that only includes pathways with more than one parameter (i.e.static <S extends CommandSource>
HelpFilter<S>depth(int minSize, int maxSize) Creates a filter based on pathway parameter count (depth).static <S extends CommandSource>
HelpFilter<S>Creates a filter that only includes pathways containing at least one optional parameter.static <S extends CommandSource>
HelpFilter<S>hasPermission(S source, CommandHelp<S> help) Creates a filter that checks if a source has permission for the pathway.static <S extends CommandSource>
HelpFilter<S>hasPermission(S source, CommandContext<S> context) Creates a filter that checks if a source has permission for the pathway.static <S extends CommandSource>
HelpFilter<S>hasPermission(S source, PermissionChecker<S> checker) Creates a filter that checks if a source has permission for the pathway.static <S extends CommandSource>
HelpFilter<S>nameContains(String substring) Creates a filter that matches pathways whose formatted usage contains a substring.static <S extends CommandSource>
HelpFilter<S>nameMatches(String pattern) Creates a filter that matches the pathway's formatted usage against a regex pattern.static <S extends CommandSource>
HelpFilter<S>none()Creates a filter that never passes (excludes all pathways).static <S extends CommandSource>
HelpFilter<S>Creates a filter that only includes pathways without any permission requirement.static <S extends CommandSource>
HelpFilter<S>withPermission(String permission) Creates a filter that only includes pathways with a specific permission.
-
Method Details
-
depth
Creates a filter based on pathway parameter count (depth).- Parameters:
minSize- minimum number of parameters (inclusive)maxSize- maximum number of parameters (inclusive)
-
hasPermission
public static <S extends CommandSource> HelpFilter<S> hasPermission(S source, PermissionChecker<S> checker) Creates a filter that checks if a source has permission for the pathway.- Parameters:
source- the source to check permissions forchecker- the permission checker
-
hasPermission
public static <S extends CommandSource> HelpFilter<S> hasPermission(S source, CommandContext<S> context) Creates a filter that checks if a source has permission for the pathway.- Parameters:
source- the source to check permissions forcontext- the context.
-
hasPermission
Creates a filter that checks if a source has permission for the pathway.- Parameters:
source- the source to check permissions forhelp- the command help.
-
withPermission
Creates a filter that only includes pathways with a specific permission.- Parameters:
permission- the required permission
-
noPermission
Creates a filter that only includes pathways without any permission requirement. -
nameMatches
Creates a filter that matches the pathway's formatted usage against a regex pattern.- Parameters:
pattern- regex pattern to match
-
nameContains
Creates a filter that matches pathways whose formatted usage contains a substring.- Parameters:
substring- the substring to search for (case-insensitive)
-
hasOptionalParam
Creates a filter that only includes pathways containing at least one optional parameter. -
all
Creates a filter that always passes (includes all pathways). -
none
Creates a filter that never passes (excludes all pathways). -
allOf
Creates a composite filter from multiple filters (AND logic).- Parameters:
filters- the filters to combine
-
anyOf
Creates a composite filter from multiple filters (OR logic).- Parameters:
filters- the filters to combine
-
childrenOnly
Creates a filter that only includes pathways with more than one parameter (i.e. not root-only).
-