public static class Command.Category
extends java.lang.Object
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.Constructor and Description |
---|
Category(java.lang.String name)
A Command Category containing a name.
|
Category(java.lang.String name,
java.util.function.Predicate<CommandEvent> predicate)
A Command Category containing a name and a
Predicate . |
Category(java.lang.String name,
java.lang.String failResponse,
java.util.function.Predicate<CommandEvent> predicate)
A Command Category containing a name, a
Predicate ,
and a failure response. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getFailureResponse()
Gets the failure response of the Category.
|
java.lang.String |
getName()
Gets the name of the Category.
|
int |
hashCode() |
boolean |
test(CommandEvent event)
Runs a test of the provided
Predicate . |
public Category(java.lang.String name)
name
- The name of the Categorypublic Category(java.lang.String name, java.util.function.Predicate<CommandEvent> predicate)
Predicate
.
The command will be terminated if
test(com.jagrosh.jdautilities.command.CommandEvent)
returns false
.
name
- The name of the Categorypredicate
- The Category predicate to testpublic Category(java.lang.String name, java.lang.String failResponse, java.util.function.Predicate<CommandEvent> predicate)
Predicate
,
and a failure response.
The command will be terminated if
test(com.jagrosh.jdautilities.command.CommandEvent)
returns false
, and the failure response will be sent.
name
- The name of the CategoryfailResponse
- The response if the test failspredicate
- The Category predicate to testpublic java.lang.String getName()
public java.lang.String getFailureResponse()
public boolean test(CommandEvent event)
Predicate
.event
- The CommandEvent
that was called when this method is invokedtrue
if the Predicate was not set, was set as null, or was
tested and returned true, otherwise returns false
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object