diff options
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/PluginManager.cpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 19d2e8b4d..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[] } @@ -601,6 +602,30 @@ 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): + if (a_Player != nullptr) + { + 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 + ); + } + FIND_HOOK(HOOK_EXECUTE_COMMAND); VERIFY_HOOK; |