Fixed callbacks

This commit is contained in:
Max Klaversma 2014-04-17 22:41:34 +02:00 committed by Steffen Schröder
parent 8f81a62df6
commit 0b9838f0fb
2 changed files with 9 additions and 5 deletions

View File

@ -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);
}
/**

View File

@ -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);