diff options
author | Mattes D <github@xoft.cz> | 2017-01-17 22:38:04 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2017-01-18 09:03:05 +0100 |
commit | 7cc3fb098df221f083da1d81d2327a0a5f22edf5 (patch) | |
tree | de9232cbf239800ea1e7a71cf52086509a9472ea /src/Bindings/PluginManager.cpp | |
parent | Debuggers: Added a deadlock simulation command. (diff) | |
download | cuberite-7cc3fb098df221f083da1d81d2327a0a5f22edf5.tar cuberite-7cc3fb098df221f083da1d81d2327a0a5f22edf5.tar.gz cuberite-7cc3fb098df221f083da1d81d2327a0a5f22edf5.tar.bz2 cuberite-7cc3fb098df221f083da1d81d2327a0a5f22edf5.tar.lz cuberite-7cc3fb098df221f083da1d81d2327a0a5f22edf5.tar.xz cuberite-7cc3fb098df221f083da1d81d2327a0a5f22edf5.tar.zst cuberite-7cc3fb098df221f083da1d81d2327a0a5f22edf5.zip |
Diffstat (limited to 'src/Bindings/PluginManager.cpp')
-rw-r--r-- | src/Bindings/PluginManager.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 276b08ce7..e190abe15 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -32,8 +32,9 @@ cPluginManager * cPluginManager::Get(void) -cPluginManager::cPluginManager(void) : - m_bReloadPlugins(false) +cPluginManager::cPluginManager(cDeadlockDetect & a_DeadlockDetect) : + m_bReloadPlugins(false), + m_DeadlockDetect(a_DeadlockDetect) { } @@ -98,7 +99,7 @@ void cPluginManager::RefreshPluginList(void) } // for plugin - m_Plugins[] if (!hasFound) { - m_Plugins.push_back(std::make_shared<cPluginLua>(folder)); + m_Plugins.push_back(std::make_shared<cPluginLua>(folder, m_DeadlockDetect)); } } // for folder - Folders[] } @@ -602,25 +603,28 @@ bool cPluginManager::CallHookEntityChangedWorld(cEntity & a_Entity, cWorld & a_W bool cPluginManager::CallHookExecuteCommand(cPlayer * a_Player, const AStringVector & a_Split, const AString & a_EntireCommand, CommandResult & a_Result) { // Output the command being executed to log (for troubleshooting deadlocks-in-commands): - auto world = a_Player->GetWorld(); - AString worldName; - Int64 worldAge; - if (world != nullptr) + if (a_Player != nullptr) { - worldName = world->GetName(); - worldAge = world->GetWorldAge(); - } - else - { - worldName = "<no world>"; - worldAge = 0; + auto world = a_Player->GetWorld(); + AString worldName; + Int64 worldAge; + if (world != nullptr) + { + worldName = world->GetName(); + worldAge = world->GetWorldAge(); + } + else + { + worldName = "<no world>"; + worldAge = 0; + } + LOG("Player %s is executing command \"%s\" in world \"%s\" at world age %lld.", + a_Player->GetName().c_str(), + a_EntireCommand.c_str(), + worldName.c_str(), + worldAge + ); } - LOG("Player %s is executing command \"%s\" in world \"%s\" at world age %lld.", - a_Player->GetName().c_str(), - a_EntireCommand.c_str(), - worldName.c_str(), - worldAge - ); FIND_HOOK(HOOK_EXECUTE_COMMAND); VERIFY_HOOK; |