10 chat_commands_.push_back(std::make_shared<ChatCommand>(command, callback));
16 console_commands_.push_back(std::make_shared<ConsoleCommand>(command, callback));
21 rcon_commands_.push_back(std::make_shared<RconCommand>(command, callback));
26 on_tick_callbacks_.push_back(std::make_shared<OnTickCallback>(id, callback));
31 on_timer_callbacks_.push_back(std::make_shared<OnTimerCallback>(id, callback));
36 on_chat_message_callbacks_.push_back(std::make_shared<OnChatMessageCallback>(id, callback));
41 return RemoveCommand<ChatCommand>(command, chat_commands_);
46 return RemoveCommand<ConsoleCommand>(command, console_commands_);
51 return RemoveCommand<RconCommand>(command, rcon_commands_);
56 return RemoveCommand<OnTickCallback>(id, on_tick_callbacks_);
61 return RemoveCommand<OnTimerCallback>(id, on_timer_callbacks_);
66 return RemoveCommand<OnChatMessageCallback>(id, on_chat_message_callbacks_);
71 return CheckCommands<ChatCommand>(*message, chat_commands_, shooter_player_controller, message, mode, platform);
76 return CheckCommands<ConsoleCommand>(*cmd, console_commands_, a_player_controller, cmd, write_to_log);
82 return CheckCommands<RconCommand>(rcon_packet->Body, rcon_commands_, rcon_client_connection, rcon_packet,
88 const auto tmp_tick_callbacks = on_tick_callbacks_;
89 for (
const auto& data : tmp_tick_callbacks)
93 data->callback(delta_seconds);
100 const auto tmp_timer_callbacks = on_timer_callbacks_;
101 for (
const auto& data : tmp_timer_callbacks)
116 bool command_executed)
118 const auto tmp_chat_callbacks = on_chat_message_callbacks_;
120 bool prevent_default =
false;
121 for (
const auto& data : tmp_chat_callbacks)
123 prevent_default |= data->callback(player_controller, message, mode, platform, spam_check, command_executed);
126 return prevent_default;
132 return *API::game_api->GetCommands();
void AddRconCommand(const FString &command, const std::function< void(RCONClientConnection *, RCONPacket *, UWorld *)> &callback) override
Adds a rcon command.
void CheckOnTickCallbacks(float delta_seconds)
bool CheckRconCommands(RCONClientConnection *rcon_client_connection, RCONPacket *rcon_packet, UWorld *u_world)
void CheckOnTimerCallbacks()
void AddOnTimerCallback(const FString &id, const std::function< void()> &callback) override
Added function will be called every second.
bool CheckChatCommands(AShooterPlayerController *shooter_player_controller, FString *message, int mode, int platform)
void AddOnChatMessageCallback(const FString &id, const std::function< bool(AShooterPlayerController *, FString *, int, int, bool, bool)> &callback) override
Added function will be called for AShooterPlayerController->ServerSendChatMessage events.
bool RemoveConsoleCommand(const FString &command) override
Removes a console command.
void AddChatCommand(const FString &command, const std::function< void(AShooterPlayerController *, FString *, int, int)> &callback) override
Adds a chat command.
void AddConsoleCommand(const FString &command, const std::function< void(APlayerController *, FString *, bool)> &callback) override
Adds a console command.
bool RemoveRconCommand(const FString &command) override
Removes a rcon command.
bool CheckConsoleCommands(APlayerController *a_player_controller, FString *cmd, bool write_to_log)
void AddOnTickCallback(const FString &id, const std::function< void(float)> &callback) override
Added function will be called every frame.
bool RemoveChatCommand(const FString &command) override
Removes a chat command.
bool RemoveOnTimerCallback(const FString &id) override
Removes an on-timer callback.
bool CheckOnChatMessageCallbacks(AShooterPlayerController *player_controller, FString *message, int mode, int platform, bool spam_check, bool command_executed)
bool RemoveOnChatMessageCallback(const FString &id) override
Removes an on-chat-message callback.
bool RemoveOnTickCallback(const FString &id) override
Removes a on-tick callback.
ARK_API ICommands &APIENTRY GetCommands()