Class NoneOf<M>
- java.lang.Object
-
- net.kautler.command.api.restriction.NoneOf<M>
-
- Type Parameters:
M
- the class of the messages for which this restriction can check allowance
- All Implemented Interfaces:
Restriction<M>
public abstract class NoneOf<M> extends Object implements Restriction<M>
A restriction that checks multiple other restrictions none of which may allow a command. To use it, create a trivial subclass of this class and make it a discoverable CDI bean, for example by annotating it with@ApplicationScoped
.Example:
ApplicationScoped public class NeitherRoleANorRoleB extends NoneOf<Message>
{Inject private NeitherRoleANorRoleB(RoleA roleA, RoleB roleB) { super(roleA, roleB); }
}
-
-
Constructor Summary
Constructors Constructor Description NoneOf(Restriction<? super M>... restrictions)
Constructs a new none-of restriction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allowCommand(M message)
Returns whether a command caused by the given message should be allowed by this restriction or not.
-
-
-
Constructor Detail
-
NoneOf
@SafeVarargs public NoneOf(Restriction<? super M>... restrictions)
Constructs a new none-of restriction.- Parameters:
restrictions
- the restrictions of which none may allow a command
-
-
Method Detail
-
allowCommand
public boolean allowCommand(M message)
Description copied from interface:Restriction
Returns whether a command caused by the given message should be allowed by this restriction or not.- Specified by:
allowCommand
in interfaceRestriction<M>
- Parameters:
message
- the message that caused the command to check allowance for- Returns:
- whether a command caused by the given message should be allowed by this restriction or not
-
-