Command
endstone.command
¶
Classes:
Name | Description |
---|---|
Command |
Represents a Command, which executes various tasks upon user input |
CommandExecutor |
Represents a class which contains a single method for executing commands |
CommandSender |
Represents a command sender. |
CommandSenderWrapper |
Represents a wrapper that forwards commands to the wrapped CommandSender and captures its output |
ConsoleCommandSender |
Represents a console command sender. |
Command
¶
Command(
name: str,
description: str | None = None,
usages: list[str] | None = None,
aliases: list[str] | None = None,
permissions: list[str] | None = None,
*args,
**kwargs
)
Represents a Command, which executes various tasks upon user input
Methods:
Name | Description |
---|---|
execute |
Executes the command, returning its success |
test_permission |
Tests the given CommandSender to see if they can perform this command. |
test_permission_silently |
Tests the given CommandSender to see if they can perform this command. No error is sent to the sender. |
Attributes:
Name | Type | Description |
---|---|---|
aliases |
list[str]
|
List of aliases of this command |
description |
str
|
Brief description of this command |
name |
str
|
Name of this command. |
permissions |
list[str]
|
The permissions required by users to be able to perform this command |
registered |
bool
|
Returns the current registered state of this command |
usages |
list[str]
|
List of usages of this command |
permissions
property
writable
¶
The permissions required by users to be able to perform this command
execute
¶
execute(sender: CommandSender, args: list[str]) -> bool
Executes the command, returning its success
test_permission
¶
test_permission(target: CommandSender) -> bool
Tests the given CommandSender to see if they can perform this command.
test_permission_silently
¶
test_permission_silently(target: CommandSender) -> bool
Tests the given CommandSender to see if they can perform this command. No error is sent to the sender.
CommandExecutor
¶
Represents a class which contains a single method for executing commands
Methods:
Name | Description |
---|---|
on_command |
Executes the given command, returning its success. |
CommandSender
¶
Bases: Permissible
Represents a command sender.
Methods:
Name | Description |
---|---|
send_error_message |
Sends this sender an error message |
send_message |
Sends this sender a message |
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Gets the name of this command sender |
server |
Server
|
Returns the server instance that this command is running on |
send_error_message
¶
send_error_message(message: str | Translatable) -> None
Sends this sender an error message
CommandSenderWrapper
¶
CommandSenderWrapper(
sender: CommandSender,
on_message: Callable[[str | Translatable], None] = None,
on_error: Callable[[str | Translatable], None] = None,
)
Bases: CommandSender
Represents a wrapper that forwards commands to the wrapped CommandSender and captures its output