Package revxrsal.commands.process
Interface SenderResolver
- All Known Implementing Classes:
AudienceSenderResolver
public interface SenderResolver
Represents a special resolver for parameters that are always first in
command methods. These parameters can be treated as referring to the
command actor.
Registering a custom sender resolver allows using certain types as
senders. The custom types must be tested inside isCustomType(Class)
,
and it is recommended to use CustomType.class.isAssignableFrom(type)
to
make sure subclasses are respected.
Register with CommandHandler.registerSenderResolver(SenderResolver)
.
-
Method Summary
Modifier and TypeMethodDescription@NotNull Object
getSender
(@NotNull Class<?> customSenderType, @NotNull CommandActor actor, @NotNull ExecutableCommand command) Returns the custom sender value from the given contextboolean
isCustomType
(Class<?> type) Tests whether is the specified type a custom sender type or not
-
Method Details
-
isCustomType
Tests whether is the specified type a custom sender type or not- Parameters:
type
- Type to test- Returns:
- True if it is a custom type, false if otherwise.
-
getSender
@NotNull @NotNull Object getSender(@NotNull @NotNull Class<?> customSenderType, @NotNull @NotNull CommandActor actor, @NotNull @NotNull ExecutableCommand command) Returns the custom sender value from the given context- Parameters:
customSenderType
- The type of the custom sender. This matches the command parameter type.actor
- The command actorcommand
- The command being executed- Returns:
- The custom sender value. This must not be null.
-