static void SetServerID(RCONClientConnection *, RCONPacket *, UWorld *)
std::string GetApiName() override
bool DownloadCacheFiles(const std::filesystem::path downloadFile, const std::filesystem::path localFile)
std::unique_ptr< AsaApi::IApiUtils > & GetApiUtils() override
static void LoadPluginCmd(APlayerController *, FString *, bool)
std::unique_ptr< AsaApi::ICommands > commands_
void RegisterCommands() override
float GetVersion() override
~ArkBaseApi() override=default
static FString LoadPlugin(FString *cmd)
static void UnloadPluginRcon(RCONClientConnection *, RCONPacket *, UWorld *)
nlohmann::json GetConfig()
std::unique_ptr< AsaApi::IApiUtils > api_utils_
static void UnloadPluginCmd(APlayerController *, FString *, bool)
static void LoadPluginRcon(RCONClientConnection *, RCONPacket *, UWorld *)
static FString UnloadPlugin(FString *cmd)
std::unique_ptr< AsaApi::ICommands > & GetCommands() override
std::unique_ptr< AsaApi::IHooks > & GetHooks() override
std::unique_ptr< AsaApi::IHooks > hooks_
Hooks(const Hooks &)=delete
Hooks & operator=(const Hooks &)=delete
std::unordered_map< std::string, std::vector< std::shared_ptr< Hook > > > all_hooks_
~Hooks() override=default
Hooks & operator=(Hooks &&)=delete
bool DisableHook(const std::string &func_name, LPVOID detour) override
Removes a hook from a function.
bool SetHookInternal(const std::string &func_name, LPVOID detour, LPVOID *original) override
std::vector< std::shared_ptr< Plugin > > loaded_plugins_
void CheckPluginsDependencies()
std::vector< std::shared_ptr< Plugin > >::const_iterator FindPlugin(const std::string &plugin_name)
Find plugin by it's name.
bool save_world_before_reload_
PluginManager & operator=(const PluginManager &)=delete
void DetectPluginChanges()
time_t next_reload_check_
PluginManager(const PluginManager &)=delete
PluginManager(PluginManager &&)=delete
void LoadAllPlugins()
Find and load all plugins.
static PluginManager & Get()
static nlohmann::json ReadPluginInfo(const std::string &plugin_name)
bool enable_plugin_reload_
bool IsPluginLoaded(const std::string &plugin_name)
Returns true if plugin was loaded, false otherwise.
std::shared_ptr< Plugin > & LoadPlugin(const std::string &plugin_name) noexcept(false)
Load plugin by it's name.
static void DetectPluginChangesTimerCallback()
Checks for auto plugin reloads.
int reload_sleep_seconds_
void UnloadPlugin(const std::string &plugin_name) noexcept(false)
Unload plugin by it's name. Plugin must free all used resources.
PluginManager & operator=(PluginManager &&)=delete
static nlohmann::json ReadSettingsConfig()
void AddRconCommand(const FString &command, const std::function< void(RCONClientConnection *, RCONPacket *, UWorld *)> &callback) override
Adds a rcon command.
std::vector< std::shared_ptr< OnTickCallback > > on_tick_callbacks_
bool CheckCommands(const FString &message, const std::vector< std::shared_ptr< T > > &commands, Args &&... args)
~Commands() override=default
std::vector< std::shared_ptr< ConsoleCommand > > console_commands_
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.
std::vector< std::shared_ptr< ChatCommand > > chat_commands_
std::vector< std::shared_ptr< OnTimerCallback > > on_timer_callbacks_
Commands & operator=(const Commands &)=delete
std::vector< std::shared_ptr< OnChatMessageCallback > > on_chat_message_callbacks_
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.
Commands(Commands &&)=delete
Commands(const Commands &)=delete
Commands & operator=(Commands &&)=delete
void AddConsoleCommand(const FString &command, const std::function< void(APlayerController *, FString *, bool)> &callback) override
Adds a console command.
bool RemoveCommand(const FString &command, std::vector< std::shared_ptr< T > > &commands)
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)
std::vector< std::shared_ptr< RconCommand > > rcon_commands_
bool RemoveOnChatMessageCallback(const FString &id) override
Removes an on-chat-message callback.
bool RemoveOnTickCallback(const FString &id) override
Removes a on-tick callback.
static const FColor Green
UE_NODISCARD FORCEINLINE const TCHAR * operator*() const UE_LIFETIMEBOUND
constexpr float api_version
IApiUtils & GetApiUtils()
Hook(LPVOID target, LPVOID detour, LPVOID *original)
std::vector< std::string > dependencies
Plugin(HINSTANCE h_module, std::string name, std::string full_name, std::string description, float version, float min_api_version, std::vector< std::string > dependencies)
Command(FString command, std::function< T > callback)
std::function< T > callback
void SendMessageW(int Id, int Type, FString *OutGoingMessage)