Class SubCommandHolder
- java.lang.Object
-
- com.github.siroshun09.mccommand.common.SubCommandHolder
-
public class SubCommandHolder extends Object
A class that holds the subcommands
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)@Unmodifiable @NotNull List<Command>getSubCommands()Gets subcommands that is included in this holder.inthashCode()static @NotNull SubCommandHolderof(@NotNull Command... subCommands)Create aSubCommandHolderfrom specified subcommands.static @NotNull SubCommandHolderof(@NotNull Collection<Command> subCommands)Create aSubCommandHolderfrom a collection of subcommands.@Nullable Commandsearch(@NotNull Argument argument)Gets the command whose name matches the string contained in theArgument.@Nullable Commandsearch(@NotNull String str)Gets the command whose name matches the string.@NotNull Optional<Command>searchOptional(@NotNull Argument argument)Gets the command whose name matches the string contained in theArgument.@NotNull Optional<Command>searchOptional(@NotNull String str)Gets the command whose name matches the string.StringtoString()
-
-
-
Method Detail
-
of
@Contract("_ -> new") @NotNull public static @NotNull SubCommandHolder of(@NotNull @NotNull Collection<Command> subCommands)Create aSubCommandHolderfrom a collection of subcommands.- Parameters:
subCommands- the subcommands in the holder- Returns:
- a new
SubCommandHolder
-
of
@Contract("_ -> new") @NotNull public static @NotNull SubCommandHolder of(@NotNull @NotNull Command... subCommands)Create aSubCommandHolderfrom specified subcommands.- Parameters:
subCommands- the subcommands in holder- Returns:
- a new
SubCommandHolder
-
getSubCommands
@NotNull public @Unmodifiable @NotNull List<Command> getSubCommands()
Gets subcommands that is included in this holder.- Returns:
- the included subcommands in this holder
-
search
@Nullable public @Nullable Command search(@NotNull @NotNull Argument argument)
Gets the command whose name matches the string contained in theArgument.- Parameters:
argument- the argument to search- Returns:
- the matched command, or
nullif there is no match.
-
search
@Nullable public @Nullable Command search(@NotNull @NotNull String str)
Gets the command whose name matches the string.- Parameters:
str- the string to search- Returns:
- the matched command, or
nullif there is no match.
-
searchOptional
@NotNull public @NotNull Optional<Command> searchOptional(@NotNull @NotNull Argument argument)
Gets the command whose name matches the string contained in theArgument.- Parameters:
argument- the argument to search- Returns:
- the search result
-
searchOptional
@NotNull public @NotNull Optional<Command> searchOptional(@NotNull @NotNull String str)
Gets the command whose name matches the string.- Parameters:
str- the string to search- Returns:
- the search result
-
-