summaryrefslogtreecommitdiffstats
path: root/src/Bindings/PluginManager.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2017-01-18 10:51:17 +0100
committerGitHub <noreply@github.com>2017-01-18 10:51:17 +0100
commit0256daa7ca98bab7482581dad39f66d570030874 (patch)
treede9232cbf239800ea1e7a71cf52086509a9472ea /src/Bindings/PluginManager.cpp
parentUpdated Github label links (#3543) (diff)
parentDeadlockDetect now lists some tracked CS's stats. (diff)
downloadcuberite-0256daa7ca98bab7482581dad39f66d570030874.tar
cuberite-0256daa7ca98bab7482581dad39f66d570030874.tar.gz
cuberite-0256daa7ca98bab7482581dad39f66d570030874.tar.bz2
cuberite-0256daa7ca98bab7482581dad39f66d570030874.tar.lz
cuberite-0256daa7ca98bab7482581dad39f66d570030874.tar.xz
cuberite-0256daa7ca98bab7482581dad39f66d570030874.tar.zst
cuberite-0256daa7ca98bab7482581dad39f66d570030874.zip
Diffstat (limited to 'src/Bindings/PluginManager.cpp')
-rw-r--r--src/Bindings/PluginManager.cpp31
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;