diff --git a/core/Callbacks/CallbackManager.php b/core/Callbacks/CallbackManager.php index b81fd8c9..d4e45d92 100644 --- a/core/Callbacks/CallbackManager.php +++ b/core/Callbacks/CallbackManager.php @@ -4,6 +4,7 @@ namespace ManiaControl\Callbacks; use ManiaControl\General\UsageInformationAble; use ManiaControl\General\UsageInformationTrait; +use ManiaControl\Logger; use ManiaControl\ManiaControl; /** @@ -230,9 +231,19 @@ class CallbackManager implements UsageInformationAble { } // Handle callbacks + $timings = array(); + $startTime = microtime(true); $callbacks = $this->maniaControl->getClient()->executeCallbacks(); + $timings["executeCallbacks"] = microtime(true) - $startTime; + foreach ($callbacks as $callback) { + $time1 = microtime(true); $this->handleCallback($callback); + $timings[$callback[0]] = microtime(true) - $time1; + } + + if($fulltime = ((microtime(true) - $startTime) > 1)){ + $this->maniaControl->getErrorHandler()->triggerDebugNotice(json_encode(array("Long Loop Detected: " .$fulltime, $timings))); } } diff --git a/core/Callbacks/LibXmlRpcCallbacks.php b/core/Callbacks/LibXmlRpcCallbacks.php index 7ddc590b..35ffaabb 100644 --- a/core/Callbacks/LibXmlRpcCallbacks.php +++ b/core/Callbacks/LibXmlRpcCallbacks.php @@ -55,7 +55,7 @@ class LibXmlRpcCallbacks implements CallbackListener { */ public function handleScriptCallback($name, $data) { if (!$this->maniaControl->getCallbackManager()->callbackListeningExists($name)) { - //return; //Leave that disabled while testing/implementing Callbacks + return; //Leave that disabled while testing/implementing Callbacks } switch ($name) { //New callbacks diff --git a/core/Callbacks/ShootManiaCallbacks.php b/core/Callbacks/ShootManiaCallbacks.php index 22e31369..e760838f 100644 --- a/core/Callbacks/ShootManiaCallbacks.php +++ b/core/Callbacks/ShootManiaCallbacks.php @@ -73,7 +73,7 @@ class ShootManiaCallbacks implements CallbackListener { */ public function handleScriptCallbacks($name, $data) { if (!$this->maniaControl->getCallbackManager()->callbackListeningExists($name)) { - //return; //Leave that disabled while testing/implementing Callbacks + return; //Leave that disabled while testing/implementing Callbacks } switch ($name) { //MP4 New Callbacks diff --git a/core/Callbacks/TrackManiaCallbacks.php b/core/Callbacks/TrackManiaCallbacks.php index 4b0d8f8b..fa7f45f5 100644 --- a/core/Callbacks/TrackManiaCallbacks.php +++ b/core/Callbacks/TrackManiaCallbacks.php @@ -51,7 +51,7 @@ class TrackManiaCallbacks implements CallbackListener { */ public function handleScriptCallbacks($name, $data) { if (!$this->maniaControl->getCallbackManager()->callbackListeningExists($name)) { - //return; //Leave that disabled while testing/implementing Callbacks + return; //Leave that disabled while testing/implementing Callbacks } switch ($name) { case Callbacks::TM_SCORES: diff --git a/core/Players/PlayerList.php b/core/Players/PlayerList.php index 15a2bd2f..90e1bd36 100644 --- a/core/Players/PlayerList.php +++ b/core/Players/PlayerList.php @@ -323,7 +323,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer $playerQuad->addTooltipLabelFeature($descriptionLabel, $description); } - if ($this->maniaControl->getServer()->isTeamMode()) { + if ($this->maniaControl->getServer()->getScriptManager()->modeIsTeamMode()) { if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) { // Force to Red-Team Quad $redQuad = new Quad_Emblems();