Package com.jagrosh.jdautilities.command
Class Command.Category
java.lang.Object
com.jagrosh.jdautilities.command.Command.Category
- Enclosing class:
Command
To be used in
Command
s as a means of
organizing commands into "Categories" as well as terminate command usage when the calling
CommandEvent
doesn't meet
certain requirements.- Author:
- John Grosh (jagrosh)
-
Constructor Summary
ConstructorDescriptionA Command Category containing a name.Category
(String name, String failResponse, Predicate<CommandEvent> predicate) A Command Category containing a name, aPredicate
, and a failure response.Category
(String name, Predicate<CommandEvent> predicate) A Command Category containing a name and aPredicate
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the failure response of the Category.getName()
Gets the name of the Category.int
hashCode()
boolean
test
(CommandEvent event) Runs a test of the providedPredicate
.
-
Constructor Details
-
Category
A Command Category containing a name.- Parameters:
name
- The name of the Category
-
Category
A Command Category containing a name and aPredicate
.The command will be terminated if
test(com.jagrosh.jdautilities.command.CommandEvent)
returnsfalse
.- Parameters:
name
- The name of the Categorypredicate
- The Category predicate to test
-
Category
A Command Category containing a name, aPredicate
, and a failure response.The command will be terminated if
test(com.jagrosh.jdautilities.command.CommandEvent)
returnsfalse
, and the failure response will be sent.- Parameters:
name
- The name of the CategoryfailResponse
- The response if the test failspredicate
- The Category predicate to test
-
-
Method Details
-
getName
Gets the name of the Category.- Returns:
- The name of the Category
-
getFailureResponse
Gets the failure response of the Category.- Returns:
- The failure response of the Category
-
test
Runs a test of the providedPredicate
. Does not support SlashCommands.- Parameters:
event
- TheCommandEvent
that was called when this method is invoked- Returns:
true
if the Predicate was not set, was set as null, or was tested and returned true, otherwise returnsfalse
-
equals
-
hashCode
public int hashCode()
-