Interface Restriction<M>
-
- Type Parameters:
M
- the class of the messages for which this restriction can check allowance
- All Known Implementing Classes:
AllOf
,AnyOf
,BotOwnerJavacord
,BotOwnerJavacordSlash
,BotOwnerJda
,ChannelJavacord
,ChannelJavacordSlash
,ChannelJda
,Everyone
,GuildJda
,GuildOwnerJda
,NoneOf
,NsfwChannelJavacord
,NsfwChannelJavacordSlash
,NsfwChannelJda
,PrivateMessageJavacord
,PrivateMessageJavacordSlash
,PrivateMessageJda
,RegularUserJavacord
,RegularUserJda
,RoleJavacord
,RoleJavacordSlash
,RoleJda
,ServerJavacord
,ServerJavacordSlash
,ServerManagerJavacord
,ServerManagerJavacordSlash
,ServerManagerJda
,ServerOwnerJavacord
,ServerOwnerJavacordSlash
,UserJavacord
,UserJavacordSlash
,UserJda
public interface Restriction<M>
A restriction that checks allowance for usage of a command that was caused by a given command context.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
allowCommand(CommandContext<? extends M> commandContext)
Returns whether a command caused by the given command context should be allowed by this restriction or not.default Class<?>
getRealClass()
Returns the real class of this restriction.
-
-
-
Method Detail
-
getRealClass
default Class<?> getRealClass()
Returns the real class of this restriction. Subclasses usually do not need to overwrite this method as the default implementation should be appropriate. This is necessary as CDI implementations that create proxies might not provide the real class that is necessary for restriction lookup.- Returns:
- the real class of this restriction
-
allowCommand
boolean allowCommand(CommandContext<? extends M> commandContext)
Returns whether a command caused by the given command context should be allowed by this restriction or not.- Parameters:
commandContext
- the command context, usually fully populated- Returns:
- whether a command caused by the given command context should be allowed by this restriction or not
-
-