Interface Commander
-
- All Superinterfaces:
net.kyori.adventure.audience.Audience,net.kyori.adventure.audience.ForwardingAudience,net.kyori.adventure.audience.ForwardingAudience.Single
public interface Commander extends net.kyori.adventure.audience.ForwardingAudience.Single
An actor that can perform commands and receive messages.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <C extends net.kyori.adventure.text.BuildableComponent<C,B>,B extends net.kyori.adventure.text.ComponentBuilder<C,B>>
Bcallback(B builder, Consumer<Commander> callback)Adds a click event to the provided component builderdefault voidcheckPermission(Permission permission)default voidcheckPermission(String permission)default voidcheckSubjectPermission(String basePermission, ca.stellardrift.permissionsex.subject.SubjectRef<?> subject)Check a permission specialized for a certain subject type.default voiddebug(net.kyori.adventure.text.ComponentLike text)Send debug text.default voiderror(net.kyori.adventure.text.ComponentLike text)Send an error message.default voiderror(net.kyori.adventure.text.ComponentLike text, @Nullable Throwable error)Send an error message to the client.MessageFormatterformatter()A formatter providing formatting options for messages sent to this commander.default booleanhasPermission(Permission permission)booleanhasPermission(String permission)Get whether this commander has a certain permission.net.kyori.adventure.text.Componentname()The display name for the actor, to be used in any potential action logging.default voidsendMessage(@NonNull net.kyori.adventure.identity.Identified source, @NonNull net.kyori.adventure.text.Component message, @NonNull net.kyori.adventure.audience.MessageType type)default voidsendMessage(@NonNull net.kyori.adventure.identity.Identity source, @NonNull net.kyori.adventure.text.Component message, @NonNull net.kyori.adventure.audience.MessageType type)default voidsendPaginated(net.kyori.adventure.text.ComponentLike title, @Nullable net.kyori.adventure.text.ComponentLike header, Collection<? extends net.kyori.adventure.text.ComponentLike> lines)Send a paginated list to the user.default voidsendPaginated(net.kyori.adventure.text.ComponentLike title, @Nullable net.kyori.adventure.text.ComponentLike header, Stream<? extends net.kyori.adventure.text.ComponentLike> lines)Send a paginated list to the user.default voidsendPaginated(net.kyori.adventure.text.ComponentLike title, Collection<? extends net.kyori.adventure.text.ComponentLike> lines)Send a paginated list to the user.default voidsendPaginated(net.kyori.adventure.text.ComponentLike title, Stream<? extends net.kyori.adventure.text.ComponentLike> lines)Send a paginated list to the user.@Nullable ca.stellardrift.permissionsex.subject.SubjectRef<?>subjectIdentifier()A reference to the subject used-
Methods inherited from interface net.kyori.adventure.audience.Audience
openBook, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter
-
Methods inherited from interface net.kyori.adventure.audience.ForwardingAudience.Single
audience, audiences, clearTitle, hideBossBar, openBook, playSound, playSound, resetTitle, sendActionBar, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, showBossBar, showTitle, stopSound
-
-
-
-
Method Detail
-
name
net.kyori.adventure.text.Component name()
The display name for the actor, to be used in any potential action logging.- Returns:
- the name
-
subjectIdentifier
@Nullable ca.stellardrift.permissionsex.subject.SubjectRef<?> subjectIdentifier()
A reference to the subject used- Returns:
- a subject identifier
-
formatter
MessageFormatter formatter()
A formatter providing formatting options for messages sent to this commander.This is usually the same message formatter exposed in
MinecraftPermissionsEx.messageFormatter().- Returns:
- the formatter
-
hasPermission
boolean hasPermission(String permission)
Get whether this commander has a certain permission.This result might not match checking the subject identified by
subjectIdentifier()due to additional context that may be present in command execution.- Parameters:
permission- the permission to test- Returns:
- whether this subject has a certain permission
-
hasPermission
default boolean hasPermission(Permission permission)
-
checkPermission
default void checkPermission(String permission) throws CommandPermissionException
- Throws:
CommandPermissionException
-
checkPermission
default void checkPermission(Permission permission) throws CommandPermissionException
- Throws:
CommandPermissionException
-
checkSubjectPermission
default void checkSubjectPermission(String basePermission, ca.stellardrift.permissionsex.subject.SubjectRef<?> subject) throws CommandException
Check a permission specialized for a certain subject type.- Parameters:
basePermission- the base permission to usesubject- the specific subject to validate- Throws:
CommandException- thrown if the permission check fails
-
sendMessage
default void sendMessage(@NonNull net.kyori.adventure.identity.Identified source, @NonNull net.kyori.adventure.text.Component message, @NonNull net.kyori.adventure.audience.MessageType type)
The message should be colored the appropriate output colour if it does not yet have a colour
- Specified by:
sendMessagein interfacenet.kyori.adventure.audience.Audience- Specified by:
sendMessagein interfacenet.kyori.adventure.audience.ForwardingAudience- Specified by:
sendMessagein interfacenet.kyori.adventure.audience.ForwardingAudience.Single
-
sendMessage
default void sendMessage(@NonNull net.kyori.adventure.identity.Identity source, @NonNull net.kyori.adventure.text.Component message, @NonNull net.kyori.adventure.audience.MessageType type)
The message should be colored the appropriate output colour if it does not yet have a colour
- Specified by:
sendMessagein interfacenet.kyori.adventure.audience.Audience- Specified by:
sendMessagein interfacenet.kyori.adventure.audience.ForwardingAudience- Specified by:
sendMessagein interfacenet.kyori.adventure.audience.ForwardingAudience.Single
-
debug
default void debug(net.kyori.adventure.text.ComponentLike text)
Send debug text.- Parameters:
text- the text that will be sent
-
error
default void error(net.kyori.adventure.text.ComponentLike text)
Send an error message.- Parameters:
text- the error message
-
error
default void error(net.kyori.adventure.text.ComponentLike text, @Nullable Throwable error)
Send an error message to the client.- Parameters:
text- the message to senderror- an exception to optionally expose as a hover event on the message.
-
sendPaginated
default void sendPaginated(net.kyori.adventure.text.ComponentLike title, Collection<? extends net.kyori.adventure.text.ComponentLike> lines)
Send a paginated list to the user.- Parameters:
title- a titlelines- the lines to send
-
sendPaginated
default void sendPaginated(net.kyori.adventure.text.ComponentLike title, @Nullable net.kyori.adventure.text.ComponentLike header, Collection<? extends net.kyori.adventure.text.ComponentLike> lines)
Send a paginated list to the user.- Parameters:
title- a titleheader- a header/subtitlelines- the lines to send
-
sendPaginated
default void sendPaginated(net.kyori.adventure.text.ComponentLike title, Stream<? extends net.kyori.adventure.text.ComponentLike> lines)
Send a paginated list to the user.- Parameters:
title- a titlelines- the lines to send
-
sendPaginated
default void sendPaginated(net.kyori.adventure.text.ComponentLike title, @Nullable net.kyori.adventure.text.ComponentLike header, Stream<? extends net.kyori.adventure.text.ComponentLike> lines)
Send a paginated list to the user.- Parameters:
title- a titleheader- a header/subtitlelines- the lines to send
-
callback
default <C extends net.kyori.adventure.text.BuildableComponent<C,B>,B extends net.kyori.adventure.text.ComponentBuilder<C,B>> B callback(B builder, Consumer<Commander> callback)
Adds a click event to the provided component builder- Parameters:
callback- The function to call- Returns:
- The updated text
-
-