Home Commands Examples Getting Started With Scripts Global Keywords 1.21 Migration Guide
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

CommandSource

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.command.CommandSource;

Description

Represents a source of a command execution, such as an Entity or the MinecraftServer.

Members

Getter
Checks if the commands from this source should return failure messages
script.zs
// CommandSource.acceptsFailure as bool
myCommandSource.acceptsFailure

Return Type: bool

acceptsFailure() as bool
Checks if the commands from this source should return failure messages

Returns: True if the commands from this source should return failure messages, false otherwise.

script.zs
// CommandSource.acceptsFailure() as bool;
myCommandSource.acceptsFailure();

Return Type: bool

Getter
Checks if the commands from this source should return successful messages
script.zs
// CommandSource.acceptsSuccess as bool
myCommandSource.acceptsSuccess

Return Type: bool

acceptsSuccess() as bool
Checks if the commands from this source should return successful messages

Returns: True if the commands from this source should return successful messages, false otherwise.

script.zs
// CommandSource.acceptsSuccess() as bool;
myCommandSource.acceptsSuccess();

Return Type: bool

Getter
Checks if the command source always accepts.
script.zs
// CommandSource.alwaysAccepts as bool
myCommandSource.alwaysAccepts

Return Type: bool

alwaysAccepts() as bool
Checks if the command source always accepts.

Returns: True if the command source always accepts, false otherwise.

script.zs
// CommandSource.alwaysAccepts() as bool;
myCommandSource.alwaysAccepts();

Return Type: bool

sendMessage(component as Component)
Sends a message to the command source.
script.zs
// CommandSource.sendMessage(component as Component);
myCommandSource.sendMessage(myComponent);

Parameters:

component Type: Component - The message to send.
Getter
Checks if the commands from this source should inform admins.
script.zs
// CommandSource.shouldInformAdmins as bool
myCommandSource.shouldInformAdmins

Return Type: bool

shouldInformAdmins() as bool
Checks if the commands from this source should inform admins.

Returns: True if the commands from this source should inform admins, false otherwise.

script.zs
// CommandSource.shouldInformAdmins() as bool;
myCommandSource.shouldInformAdmins();

Return Type: bool