Skip to content

Class endstone::ServerCommandEvent

ClassList > endstone > ServerCommandEvent

Called when a command is run by a non-player, early in the command handling process. More...

  • #include <endstone/event/server/server_command_event.h>

Inherits the following classes: endstone::Cancellable

Public Functions

Type Name
ENDSTONE_EVENT (ServerCommandEvent)
ServerCommandEvent (CommandSender & sender, std::string command)
std::string getCommand () const
Gets the command that the server is attempting to execute from the console.
CommandSender & getSender () const
Get the command sender.
void setCommand (std::string command)
Sets the command that the server will execute.

Public Functions inherited from endstone::Cancellable

See endstone::Cancellable

Type Name
virtual void cancel ()
Cancel this event.
virtual bool isCancelled () override const
Gets the cancellation state of this event.
virtual void setCancelled (bool cancel) override
Sets the cancellation state of this event.

Public Functions inherited from endstone::ICancellable

See endstone::ICancellable

Type Name
virtual void cancel () = 0
Cancels this event.
virtual bool isCancelled () const = 0
Gets the cancellation state of this event.
virtual void setCancelled (bool cancel) = 0
Sets the cancellation state of this event.
virtual ~ICancellable () = default

Detailed Description

You should not use this except for a few cases like logging commands, blocking commands on certain places, or applying modifiers.

The command message contains a slash '/' at the start

Public Functions Documentation

function ENDSTONE_EVENT

endstone::ServerCommandEvent::ENDSTONE_EVENT (
    ServerCommandEvent
) 

function ServerCommandEvent

inline endstone::ServerCommandEvent::ServerCommandEvent (
    CommandSender & sender,
    std::string command
) 

function getCommand

Gets the command that the server is attempting to execute from the console.

inline std::string endstone::ServerCommandEvent::getCommand () const

Returns:

Command the server is attempting to execute


function getSender

Get the command sender.

inline CommandSender & endstone::ServerCommandEvent::getSender () const

Returns:

The sender


function setCommand

Sets the command that the server will execute.

inline void endstone::ServerCommandEvent::setCommand (
    std::string command
) 

Parameters:

  • command New command that the server will execute.


The documentation for this class was generated from the following file include/endstone/event/server/server_command_event.h