Class ServerJavacord
- java.lang.Object
-
- net.kautler.command.api.restriction.javacord.ServerJavacord
-
- All Implemented Interfaces:
Restriction<Message>
public abstract class ServerJavacord extends Object implements Restriction<Message>
A restriction that allows a command in certain servers and is evaluated by the Javacord command handler. To use it, create a trivial subclass of this class and make it a discoverable CDI bean, for example by annotating it with@ApplicationScoped.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedServerJavacord(long serverId)Constructs a new server restriction for checking the channel ID.protectedServerJavacord(String serverName)Constructs a new server restriction for checking the server name case-sensitively against a fixed name.protectedServerJavacord(String serverName, boolean caseSensitive)Constructs a new server restriction for checking the server name against a fixed name.protectedServerJavacord(Pattern serverPattern)Constructs a new server restriction for checking the server name against a regular expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowCommand(Message message)Returns whether a command caused by the given message should be allowed by this restriction or not.
-
-
-
Constructor Detail
-
ServerJavacord
protected ServerJavacord(long serverId)
Constructs a new server restriction for checking the channel ID.- Parameters:
serverId- the ID of the server where a command should be allowed
-
ServerJavacord
protected ServerJavacord(String serverName)
Constructs a new server restriction for checking the server name case-sensitively against a fixed name.- Parameters:
serverName- the case-sensitive name of the server where a command should be allowed
-
ServerJavacord
protected ServerJavacord(String serverName, boolean caseSensitive)
Constructs a new server restriction for checking the server name against a fixed name.- Parameters:
serverName- the name of the server where a command should be allowedcaseSensitive- whether the name should be matched case-sensitively or not
-
ServerJavacord
protected ServerJavacord(Pattern serverPattern)
Constructs a new server restriction for checking the server name against a regular expression.- Parameters:
serverPattern- the pattern against which the server name is matched to determine where a command should be allowed
-
-
Method Detail
-
allowCommand
public boolean allowCommand(Message message)
Description copied from interface:RestrictionReturns whether a command caused by the given message should be allowed by this restriction or not.- Specified by:
allowCommandin interfaceRestriction<Message>- 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
-
-