From 0b9838f0fb526fa2c3d0346a6b87e89a326a5f09 Mon Sep 17 00:00:00 2001 From: Max Klaversma Date: Thu, 17 Apr 2014 22:41:34 +0200 Subject: [PATCH] Fixed callbacks --- application/plugins/Dedimania/Dedimania.php | 10 +++++++--- application/plugins/LocalRecords.php | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/application/plugins/Dedimania/Dedimania.php b/application/plugins/Dedimania/Dedimania.php index e63c7d8e..4b5e5bdb 100644 --- a/application/plugins/Dedimania/Dedimania.php +++ b/application/plugins/Dedimania/Dedimania.php @@ -50,8 +50,9 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu const SETTING_WIDGET_LINESCOUNT = 'Widget Displayed Lines Count'; const SETTING_WIDGET_LINEHEIGHT = 'Widget Line Height'; const SETTING_DEDIMANIA_CODE = '$l[http://dedimania.net/tm2stats/?do=register]Dedimania Code for '; - const CB_DEDIMANIA_CHANGE = 'Dedimania.Change'; - const ACTION_SHOW_DEDIRECORDSLIST = 'Dedimania.ShowDediRecordsList'; + const CB_DEDIMANIA_CHANGED = 'Dedimania.Changed'; + const CB_DEDIMANIA_UPDATED = 'Dedimania.Updated'; + const ACTION_SHOW_DEDIRECORDSLIST = 'Dedimania.ShowDediRecordsList'; /** * Private Properties @@ -448,7 +449,7 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu break; } - $this->maniaControl->callbackManager->triggerCallback(self::CB_DEDIMANIA_CHANGE, array($newRecord)); + $this->maniaControl->callbackManager->triggerCallback(self::CB_DEDIMANIA_CHANGED, $newRecord); // Announce record if ($oldRecord->nullRecord || $newRecord->rank < $oldRecord->rank) { @@ -626,6 +627,7 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu } } $this->updateManialink = true; + $this->maniaControl->callbackManager->triggerCallback(self::CB_DEDIMANIA_UPDATED, $this->dedimaniaData->records); return true; }, $content, true); @@ -757,6 +759,7 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu */ private function updateDedimaniaRecordRanks() { if ($this->dedimaniaData->getRecordCount() == 0) { + $this->maniaControl->callbackManager->triggerCallback(self::CB_DEDIMANIA_UPDATED, $this->dedimaniaData->records); return; } //TODO move into class dedimania data @@ -770,6 +773,7 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu $record->rank = $rank; $rank++; } + $this->maniaControl->callbackManager->triggerCallback(self::CB_DEDIMANIA_UPDATED, $this->dedimaniaData->records); } /** diff --git a/application/plugins/LocalRecords.php b/application/plugins/LocalRecords.php index fc37f69f..40768de1 100644 --- a/application/plugins/LocalRecords.php +++ b/application/plugins/LocalRecords.php @@ -44,7 +44,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList const SETTING_NOTIFY_ONLY_DRIVER = 'Notify only the Driver on New Records'; const SETTING_NOTIFY_BEST_RECORDS = 'Notify Publicly only for the X Best Records'; const SETTING_ADJUST_OUTER_BORDER = 'Adjust outer Border to Number of actual Records'; - const CB_LOCALRECORDS_CHANGE = 'LocalRecords.Change'; + const CB_LOCALRECORDS_CHANGED = 'LocalRecords.Changed'; const ACTION_SHOW_RECORDSLIST = 'LocalRecords.ShowRecordsList'; /* @@ -276,7 +276,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList // Announce record $newRecord = $this->getLocalRecord($map, $player); - $this->maniaControl->callbackManager->triggerCallback(self::CB_LOCALRECORDS_CHANGE, array($newRecord)); + $this->maniaControl->callbackManager->triggerCallback(self::CB_LOCALRECORDS_CHANGED, $newRecord); $notifyOnlyDriver = $this->maniaControl->settingManager->getSetting($this, self::SETTING_NOTIFY_ONLY_DRIVER); $notifyOnlyBestRecords = $this->maniaControl->settingManager->getSetting($this, self::SETTING_NOTIFY_BEST_RECORDS);