From 6429025304b7ae5cc71ccb0686dc5c88e7f38acc Mon Sep 17 00:00:00 2001 From: Max Klaversma Date: Thu, 17 Apr 2014 03:42:27 +0200 Subject: [PATCH] Send changed record with callback --- application/plugins/LocalRecords.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/application/plugins/LocalRecords.php b/application/plugins/LocalRecords.php index f9148af8..f3a32aa6 100644 --- a/application/plugins/LocalRecords.php +++ b/application/plugins/LocalRecords.php @@ -175,13 +175,15 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList * @param $time */ public function handle1Second($time) { - if (!$this->updateManialink) { return; } + $this->updateManialink = false; - $manialink = $this->buildManialink(); - $this->maniaControl->manialinkManager->sendManialink($manialink); + if($this->maniaControl->settingManager->getSetting($this, self::SETTING_WIDGET_ENABLE)) { + $manialink = $this->buildManialink(); + $this->maniaControl->manialinkManager->sendManialink($manialink); + } } @@ -271,10 +273,11 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList return; } $this->updateManialink = true; - $this->maniaControl->callbackManager->triggerCallback(self::CB_LOCALRECORDS_CHANGE); // Announce record $newRecord = $this->getLocalRecord($map, $player); + $this->maniaControl->callbackManager->triggerCallback(self::CB_LOCALRECORDS_CHANGE, array($newRecord)); + $notifyOnlyDriver = $this->maniaControl->settingManager->getSetting($this, self::SETTING_NOTIFY_ONLY_DRIVER); $notifyOnlyBestRecords = $this->maniaControl->settingManager->getSetting($this, self::SETTING_NOTIFY_BEST_RECORDS); if ($notifyOnlyDriver || $notifyOnlyBestRecords > 0 && $newRecord->rank > $notifyOnlyBestRecords) {