Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
ArkApi::Commands Class Reference

#include <Commands.h>

+ Inheritance diagram for ArkApi::Commands:
+ Collaboration diagram for ArkApi::Commands:

Classes

struct  Command
 

Public Member Functions

 Commands ()=default
 
 Commands (const Commands &)=delete
 
 Commands (Commands &&)=delete
 
Commandsoperator= (const Commands &)=delete
 
Commandsoperator= (Commands &&)=delete
 
 ~Commands () override=default
 
void AddChatCommand (const FString &command, const std::function< void(AShooterPlayerController *, FString *, EChatSendMode::Type)> &callback) override
 Adds a chat command.
 
void AddConsoleCommand (const FString &command, const std::function< void(APlayerController *, FString *, bool)> &callback) override
 Adds a console command.
 
void AddRconCommand (const FString &command, const std::function< void(RCONClientConnection *, RCONPacket *, UWorld *)> &callback) override
 Adds a rcon command.
 
void AddOnTickCallback (const FString &id, const std::function< void(float)> &callback) override
 Added function will be called every frame.
 
void AddOnTimerCallback (const FString &id, const std::function< void()> &callback) override
 Added function will be called every second.
 
void AddOnChatMessageCallback (const FString &id, const std::function< bool(AShooterPlayerController *, FString *, EChatSendMode::Type, bool, bool)> &callback) override
 Added function will be called for AShooterPlayerController->ServerSendChatMessage events.
 
bool RemoveChatCommand (const FString &command) override
 Removes a chat command.
 
bool RemoveConsoleCommand (const FString &command) override
 Removes a console command.
 
bool RemoveRconCommand (const FString &command) override
 Removes a rcon command.
 
bool RemoveOnTickCallback (const FString &id) override
 Removes a on-tick callback.
 
bool RemoveOnTimerCallback (const FString &id) override
 Removes an on-timer callback.
 
bool RemoveOnChatMessageCallback (const FString &id) override
 Removes an on-chat-message callback.
 
bool CheckChatCommands (AShooterPlayerController *shooter_player_controller, FString *message, EChatSendMode::Type mode)
 
bool CheckConsoleCommands (APlayerController *a_player_controller, FString *cmd, bool write_to_log)
 
bool CheckRconCommands (RCONClientConnection *rcon_client_connection, RCONPacket *rcon_packet, UWorld *u_world)
 
void CheckOnTickCallbacks (float delta_seconds)
 
void CheckOnTimerCallbacks ()
 
bool CheckOnChatMessageCallbacks (AShooterPlayerController *player_controller, FString *message, EChatSendMode::Type mode, bool spam_check, bool command_executed)
 
- Public Member Functions inherited from ArkApi::ICommands
virtual ~ICommands ()=default
 

Private Types

using ChatCommand = Command<void(AShooterPlayerController*, FString*, EChatSendMode::Type)>
 
using ConsoleCommand = Command<void(APlayerController*, FString*, bool)>
 
using RconCommand = Command<void(RCONClientConnection*, RCONPacket*, UWorld*)>
 
using OnTickCallback = Command<void(float)>
 
using OnTimerCallback = Command<void()>
 
using OnChatMessageCallback
 

Private Member Functions

template<typename T >
bool RemoveCommand (const FString &command, std::vector< std::shared_ptr< T > > &commands)
 
template<typename T , typename... Args>
bool CheckCommands (const FString &message, const std::vector< std::shared_ptr< T > > &commands, Args &&... args)
 

Private Attributes

std::vector< std::shared_ptr< ChatCommand > > chat_commands_
 
std::vector< std::shared_ptr< ConsoleCommand > > console_commands_
 
std::vector< std::shared_ptr< RconCommand > > rcon_commands_
 
std::vector< std::shared_ptr< OnTickCallback > > on_tick_callbacks_
 
std::vector< std::shared_ptr< OnTimerCallback > > on_timer_callbacks_
 
std::vector< std::shared_ptr< OnChatMessageCallback > > on_chat_message_callbacks_
 

Detailed Description

Definition at line 12 of file Commands.h.

Member Typedef Documentation

◆ ChatCommand

◆ ConsoleCommand

Definition at line 71 of file Commands.h.

◆ OnChatMessageCallback

Initial value:

Definition at line 76 of file Commands.h.

◆ OnTickCallback

using ArkApi::Commands::OnTickCallback = Command<void(float)>
private

Definition at line 74 of file Commands.h.

◆ OnTimerCallback

using ArkApi::Commands::OnTimerCallback = Command<void()>
private

Definition at line 75 of file Commands.h.

◆ RconCommand

Definition at line 72 of file Commands.h.

Constructor & Destructor Documentation

◆ Commands() [1/3]

ArkApi::Commands::Commands ( )
default

◆ Commands() [2/3]

ArkApi::Commands::Commands ( const Commands & )
delete

◆ Commands() [3/3]

ArkApi::Commands::Commands ( Commands && )
delete

◆ ~Commands()

ArkApi::Commands::~Commands ( )
overridedefault

Member Function Documentation

◆ AddChatCommand()

void ArkApi::Commands::AddChatCommand ( const FString & command,
const std::function< void(AShooterPlayerController *, FString *, EChatSendMode::Type)> & callback )
overridevirtual

Adds a chat command.

Parameters
commandCommand name
callbackCallback function

Implements ArkApi::ICommands.

Definition at line 7 of file Commands.cpp.

◆ AddConsoleCommand()

void ArkApi::Commands::AddConsoleCommand ( const FString & command,
const std::function< void(APlayerController *, FString *, bool)> & callback )
overridevirtual

Adds a console command.

Parameters
commandCommand name
callbackCallback function

Implements ArkApi::ICommands.

Definition at line 14 of file Commands.cpp.

◆ AddOnChatMessageCallback()

void ArkApi::Commands::AddOnChatMessageCallback ( const FString & id,
const std::function< bool(AShooterPlayerController *, FString *, EChatSendMode::Type, bool, bool)> & callback )
overridevirtual

Added function will be called for AShooterPlayerController->ServerSendChatMessage events.

Parameters
idUnique ID
callbackCallback function

Implements ArkApi::ICommands.

Definition at line 36 of file Commands.cpp.

◆ AddOnTickCallback()

void ArkApi::Commands::AddOnTickCallback ( const FString & id,
const std::function< void(float)> & callback )
overridevirtual

Added function will be called every frame.

Parameters
idUnique ID
callbackCallback function

Implements ArkApi::ICommands.

Definition at line 26 of file Commands.cpp.

◆ AddOnTimerCallback()

void ArkApi::Commands::AddOnTimerCallback ( const FString & id,
const std::function< void()> & callback )
overridevirtual

Added function will be called every second.

Parameters
idUnique ID
callbackCallback function

Implements ArkApi::ICommands.

Definition at line 31 of file Commands.cpp.

◆ AddRconCommand()

void ArkApi::Commands::AddRconCommand ( const FString & command,
const std::function< void(RCONClientConnection *, RCONPacket *, UWorld *)> & callback )
overridevirtual

Adds a rcon command.

Parameters
commandCommand name
callbackCallback function

Implements ArkApi::ICommands.

Definition at line 20 of file Commands.cpp.

◆ CheckChatCommands()

bool ArkApi::Commands::CheckChatCommands ( AShooterPlayerController * shooter_player_controller,
FString * message,
EChatSendMode::Type mode )

Definition at line 73 of file Commands.cpp.

◆ CheckCommands()

template<typename T , typename... Args>
bool ArkApi::Commands::CheckCommands ( const FString & message,
const std::vector< std::shared_ptr< T > > & commands,
Args &&... args )
inlineprivate

Definition at line 99 of file Commands.h.

◆ CheckConsoleCommands()

bool ArkApi::Commands::CheckConsoleCommands ( APlayerController * a_player_controller,
FString * cmd,
bool write_to_log )

Definition at line 79 of file Commands.cpp.

◆ CheckOnChatMessageCallbacks()

bool ArkApi::Commands::CheckOnChatMessageCallbacks ( AShooterPlayerController * player_controller,
FString * message,
EChatSendMode::Type mode,
bool spam_check,
bool command_executed )

Definition at line 115 of file Commands.cpp.

◆ CheckOnTickCallbacks()

void ArkApi::Commands::CheckOnTickCallbacks ( float delta_seconds)

Definition at line 91 of file Commands.cpp.

+ Here is the caller graph for this function:

◆ CheckOnTimerCallbacks()

void ArkApi::Commands::CheckOnTimerCallbacks ( )

Definition at line 103 of file Commands.cpp.

+ Here is the caller graph for this function:

◆ CheckRconCommands()

bool ArkApi::Commands::CheckRconCommands ( RCONClientConnection * rcon_client_connection,
RCONPacket * rcon_packet,
UWorld * u_world )

Definition at line 84 of file Commands.cpp.

◆ operator=() [1/2]

Commands & ArkApi::Commands::operator= ( Commands && )
delete

◆ operator=() [2/2]

Commands & ArkApi::Commands::operator= ( const Commands & )
delete

◆ RemoveChatCommand()

bool ArkApi::Commands::RemoveChatCommand ( const FString & command)
overridevirtual

Removes a chat command.

Parameters
commandCommand name
Returns
true if success, false otherwise

Implements ArkApi::ICommands.

Definition at line 43 of file Commands.cpp.

◆ RemoveCommand()

template<typename T >
bool ArkApi::Commands::RemoveCommand ( const FString & command,
std::vector< std::shared_ptr< T > > & commands )
inlineprivate

Definition at line 80 of file Commands.h.

◆ RemoveConsoleCommand()

bool ArkApi::Commands::RemoveConsoleCommand ( const FString & command)
overridevirtual

Removes a console command.

Parameters
commandCommand name
Returns
true if success, false otherwise

Implements ArkApi::ICommands.

Definition at line 48 of file Commands.cpp.

◆ RemoveOnChatMessageCallback()

bool ArkApi::Commands::RemoveOnChatMessageCallback ( const FString & id)
overridevirtual

Removes an on-chat-message callback.

Parameters
idCallback ID
Returns
true if success, false otherwise

Implements ArkApi::ICommands.

Definition at line 68 of file Commands.cpp.

◆ RemoveOnTickCallback()

bool ArkApi::Commands::RemoveOnTickCallback ( const FString & id)
overridevirtual

Removes a on-tick callback.

Parameters
idCallback ID
Returns
true if success, false otherwise

Implements ArkApi::ICommands.

Definition at line 58 of file Commands.cpp.

◆ RemoveOnTimerCallback()

bool ArkApi::Commands::RemoveOnTimerCallback ( const FString & id)
overridevirtual

Removes an on-timer callback.

Parameters
idCallback ID
Returns
true if success, false otherwise

Implements ArkApi::ICommands.

Definition at line 63 of file Commands.cpp.

◆ RemoveRconCommand()

bool ArkApi::Commands::RemoveRconCommand ( const FString & command)
overridevirtual

Removes a rcon command.

Parameters
commandCommand name
Returns
true if success, false otherwise

Implements ArkApi::ICommands.

Definition at line 53 of file Commands.cpp.

Member Data Documentation

◆ chat_commands_

std::vector<std::shared_ptr<ChatCommand> > ArkApi::Commands::chat_commands_
private

Definition at line 124 of file Commands.h.

◆ console_commands_

std::vector<std::shared_ptr<ConsoleCommand> > ArkApi::Commands::console_commands_
private

Definition at line 125 of file Commands.h.

◆ on_chat_message_callbacks_

std::vector<std::shared_ptr<OnChatMessageCallback> > ArkApi::Commands::on_chat_message_callbacks_
private

Definition at line 130 of file Commands.h.

◆ on_tick_callbacks_

std::vector<std::shared_ptr<OnTickCallback> > ArkApi::Commands::on_tick_callbacks_
private

Definition at line 128 of file Commands.h.

◆ on_timer_callbacks_

std::vector<std::shared_ptr<OnTimerCallback> > ArkApi::Commands::on_timer_callbacks_
private

Definition at line 129 of file Commands.h.

◆ rcon_commands_

std::vector<std::shared_ptr<RconCommand> > ArkApi::Commands::rcon_commands_
private

Definition at line 126 of file Commands.h.


The documentation for this class was generated from the following files: