Package dev.polv.taleapi.command
Interface CommandSender
public interface CommandSender
Represents an entity that can execute commands.
This can be a player, the server console, or any other command source.
-
Method Summary
Modifier and TypeMethodDescriptiondefault TalePlayerasPlayer()Returns this sender as a player, if applicable.getName()Returns the name of this command sender.booleanhasPermission(String permission) Checks if this sender has the specified permission.default booleanisPlayer()Checks if this sender is a player.voidsendMessage(String message) Sends a message to this command sender.
-
Method Details
-
sendMessage
Sends a message to this command sender.- Parameters:
message- the message to send
-
hasPermission
Checks if this sender has the specified permission.Console senders typically have all permissions.
- Parameters:
permission- the permission node to check- Returns:
trueif the sender has the permission
-
getName
String getName()Returns the name of this command sender.For players, this returns their display name. For console, this typically returns "Console" or "Server".
- Returns:
- the sender's name
-
isPlayer
default boolean isPlayer()Checks if this sender is a player.- Returns:
trueif this sender is a player
-
asPlayer
Returns this sender as a player, if applicable.- Returns:
- the player, or
nullif this sender is not a player
-