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 boolean
equals(Object o)
@Unmodifiable @NotNull List<Command>
getSubCommands()
Gets subcommands that is included in this holder.int
hashCode()
static @NotNull SubCommandHolder
of(@NotNull Command... subCommands)
Create aSubCommandHolder
from specified subcommands.static @NotNull SubCommandHolder
of(@NotNull Collection<Command> subCommands)
Create aSubCommandHolder
from a collection of subcommands.@Nullable Command
search(@NotNull Argument argument)
Gets the command whose name matches the string contained in theArgument
.@Nullable Command
search(@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.String
toString()
-
-
-
Method Detail
-
of
@Contract("_ -> new") @NotNull public static @NotNull SubCommandHolder of(@NotNull @NotNull Collection<Command> subCommands)
Create aSubCommandHolder
from 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 aSubCommandHolder
from 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
null
if 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
null
if 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
-
-