![]() |
Ark Server API 3.54
Serverside plugin support for Ark Survival Evolved.
|
#include <PluginManager.h>
Public Member Functions | |
PluginManager (const PluginManager &)=delete | |
PluginManager (PluginManager &&)=delete | |
PluginManager & | operator= (const PluginManager &)=delete |
PluginManager & | operator= (PluginManager &&)=delete |
void | LoadAllPlugins () |
Find and load all plugins. | |
std::shared_ptr< Plugin > & | LoadPlugin (const std::string &plugin_name) noexcept(false) |
Load plugin by it's name. | |
void | UnloadPlugin (const std::string &plugin_name) noexcept(false) |
Unload plugin by it's name. Plugin must free all used resources. | |
std::vector< std::shared_ptr< Plugin > >::const_iterator | FindPlugin (const std::string &plugin_name) |
Find plugin by it's name. | |
bool | IsPluginLoaded (const std::string &plugin_name) |
Returns true if plugin was loaded, false otherwise. | |
Static Public Member Functions | |
static PluginManager & | Get () |
static nlohmann::json | GetAllPDBConfigs () |
Get all plugin pdb configs. | |
static void | DetectPluginChangesTimerCallback () |
Checks for auto plugin reloads. | |
Private Member Functions | |
PluginManager ()=default | |
~PluginManager ()=default | |
void | CheckPluginsDependencies () |
void | DetectPluginChanges () |
Static Private Member Functions | |
static nlohmann::json | ReadPluginInfo (const std::string &plugin_name) |
static nlohmann::json | ReadPluginPDBConfig (const std::string &plugin_name) |
static nlohmann::json | ReadSettingsConfig () |
Private Attributes | |
std::vector< std::shared_ptr< Plugin > > | loaded_plugins_ |
bool | enable_plugin_reload_ {false} |
int | reload_sleep_seconds_ {5} |
bool | save_world_before_reload_ {true} |
time_t | next_reload_check_ {5} |
Definition at line 36 of file PluginManager.h.
|
delete |
|
delete |
|
privatedefault |
|
privatedefault |
|
private |
Definition at line 265 of file PluginManager.cpp.
References Log::GetLog(), IsPluginLoaded(), and loaded_plugins_.
Referenced by LoadAllPlugins().
|
private |
Definition at line 317 of file PluginManager.cpp.
References FindPlugin(), API::game_api, ArkApi::GetApiUtils(), ArkApi::Tools::GetCurrentDir(), Log::GetLog(), ArkApi::IApiUtils::GetShooterGameMode(), loaded_plugins_, LoadPlugin(), save_world_before_reload_, AShooterGameMode::SaveWorld(), and UnloadPlugin().
|
static |
Checks for auto plugin reloads.
Definition at line 301 of file PluginManager.cpp.
References Get().
Referenced by ArkApi::Hook_AGameState_DefaultTimer().
std::vector< std::shared_ptr< Plugin > >::const_iterator API::PluginManager::FindPlugin | ( | const std::string & | plugin_name | ) |
Find plugin by it's name.
plugin_name | File name of the plugin |
Definition at line 285 of file PluginManager.cpp.
References loaded_plugins_.
Referenced by DetectPluginChanges(), and IsPluginLoaded().
|
static |
Definition at line 15 of file PluginManager.cpp.
Referenced by DetectPluginChangesTimerCallback(), ArkApi::Hook_UEngine_Init(), AtlasApi::Hook_UEngine_Init(), API::ArkBaseApi::LoadPlugin(), API::AtlasBaseApi::LoadPlugin(), API::ArkBaseApi::UnloadPlugin(), and API::AtlasBaseApi::UnloadPlugin().
|
static |
Get all plugin pdb configs.
Definition at line 21 of file PluginManager.cpp.
References API::game_api, ArkApi::Tools::GetCurrentDir(), Log::GetLog(), API::MergePdbConfig(), and ReadPluginPDBConfig().
bool API::PluginManager::IsPluginLoaded | ( | const std::string & | plugin_name | ) |
Returns true if plugin was loaded, false otherwise.
Definition at line 296 of file PluginManager.cpp.
References FindPlugin(), and loaded_plugins_.
Referenced by CheckPluginsDependencies().
void API::PluginManager::LoadAllPlugins | ( | ) |
Find and load all plugins.
Definition at line 89 of file PluginManager.cpp.
References CheckPluginsDependencies(), enable_plugin_reload_, API::game_api, ArkApi::Tools::GetCurrentDir(), Log::GetLog(), LoadPlugin(), ReadSettingsConfig(), reload_sleep_seconds_, and save_world_before_reload_.
Referenced by ArkApi::Hook_UEngine_Init(), and AtlasApi::Hook_UEngine_Init().
std::shared_ptr< Plugin > & API::PluginManager::LoadPlugin | ( | const std::string & | plugin_name | ) |
Load plugin by it's name.
plugin_name | File name of the plugin |
Definition at line 149 of file PluginManager.cpp.
References API::game_api, and ArkApi::Tools::GetCurrentDir().
Referenced by DetectPluginChanges(), LoadAllPlugins(), API::ArkBaseApi::LoadPlugin(), and API::AtlasBaseApi::LoadPlugin().
|
delete |
|
delete |
|
staticprivate |
Definition at line 234 of file PluginManager.cpp.
References API::game_api, ArkApi::Tools::GetCurrentDir(), and Log::GetLog().
|
staticprivate |
Definition at line 48 of file PluginManager.cpp.
References API::game_api, and ArkApi::Tools::GetCurrentDir().
Referenced by GetAllPDBConfigs().
|
staticprivate |
Definition at line 72 of file PluginManager.cpp.
References ArkApi::Tools::GetCurrentDir(), and nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::object().
Referenced by LoadAllPlugins().
void API::PluginManager::UnloadPlugin | ( | const std::string & | plugin_name | ) |
Unload plugin by it's name. Plugin must free all used resources.
plugin_name | File name of the plugin |
Definition at line 197 of file PluginManager.cpp.
References API::game_api, and ArkApi::Tools::GetCurrentDir().
Referenced by DetectPluginChanges(), API::ArkBaseApi::UnloadPlugin(), and API::AtlasBaseApi::UnloadPlugin().
|
private |
Definition at line 100 of file PluginManager.h.
Referenced by LoadAllPlugins().
|
private |
Definition at line 97 of file PluginManager.h.
Referenced by CheckPluginsDependencies(), DetectPluginChanges(), FindPlugin(), and IsPluginLoaded().
|
private |
Definition at line 103 of file PluginManager.h.
|
private |
Definition at line 101 of file PluginManager.h.
Referenced by LoadAllPlugins().
|
private |
Definition at line 102 of file PluginManager.h.
Referenced by DetectPluginChanges(), and LoadAllPlugins().