Interface CommandSource
- All Superinterfaces:
PermissionSubject
- All Known Subinterfaces:
Player
Represents a source that can execute commands.
This can be a player, the console, or another command source. All command sources are permission subjects and can be checked for permissions.
The Player interface extends this interface, so all players
are also command sources.
-
Method Summary
Modifier and TypeMethodDescriptionasPlayer()Get this source as a player, if applicable.default booleanCheck if this source is the console.default booleanisPlayer()Check if this source is a player.voidsendMessage(String message) Send a message to this command source.default voidsendMessage(ChatMessageBuilder builder) Send a formatted message to this command source.Methods inherited from interface PermissionSubject
getPermissionFunction, getPermissionValue, hasPermission, setPermissionFunction
-
Method Details
-
sendMessage
Send a message to this command source.- Parameters:
message- the message to send
-
sendMessage
Send a formatted message to this command source.If this source is a player, the message is sent with colors. If this source is the console, colors are stripped automatically.
- Parameters:
builder- the message builder
-
asPlayer
-
isPlayer
default boolean isPlayer()Check if this source is a player.- Returns:
- true if this is a player
-
isConsole
default boolean isConsole()Check if this source is the console.- Returns:
- true if this is the console
-