From 6caa42029eff4c3e66f02c542dc2880ef9a1e230 Mon Sep 17 00:00:00 2001 From: kremsy Date: Tue, 18 Jul 2017 21:52:52 +0200 Subject: [PATCH] Reverted Dedimania Multilap fix --- plugins/MCTeam/Dedimania/DedimaniaPlugin.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/MCTeam/Dedimania/DedimaniaPlugin.php b/plugins/MCTeam/Dedimania/DedimaniaPlugin.php index 82e27f04..c851471d 100644 --- a/plugins/MCTeam/Dedimania/DedimaniaPlugin.php +++ b/plugins/MCTeam/Dedimania/DedimaniaPlugin.php @@ -36,7 +36,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene * Constants */ const ID = 8; - const VERSION = 0.6; + const VERSION = 0.5; const AUTHOR = 'MCTeam'; const NAME = 'Dedimania Plugin'; const MLID_DEDIMANIA = 'Dedimania.ManialinkId'; @@ -110,6 +110,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene $this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'handlePlayerDisconnect'); $this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::TM_ONWAYPOINT, $this, 'handleCheckpointCallback'); $this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::TM_ONFINISHLINE, $this, 'handleFinishCallback'); + $this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::TM_ONLAPFINISH, $this, 'handleFinishCallback'); $this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'handleSettingChanged'); $this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::AFTERLOOP, $this, 'handleAfterLoop'); @@ -269,16 +270,15 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene * @param OnWayPointEventStructure $callback */ public function handleCheckpointCallback(OnWayPointEventStructure $structure) { - if (!$structure->getRaceTime()) { + if (!$structure->getLapTime()) { return; } - //TODO in Dedimania There is a small Bug somewhere with the amount of Checkpoints $login = $structure->getLogin(); if (!isset($this->checkpoints[$login])) { $this->checkpoints[$login] = array(); } - $this->checkpoints[$login][$structure->getCheckPointInRace()] = $structure->getRaceTime(); + $this->checkpoints[$login][$structure->getCheckPointInLap()] = $structure->getLapTime(); } /** @@ -305,14 +305,14 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene $player = $structure->getPlayer(); $oldRecord = $this->getDedimaniaRecord($player->login); - if ($oldRecord->nullRecord || $oldRecord && $oldRecord->best > $structure->getRaceTime()) { + if ($oldRecord->nullRecord || $oldRecord && $oldRecord->best > $structure->getLapTime()) { // Save time $newRecord = new RecordData(null); $checkPoints = $this->getCheckpoints($player->login); - $checkPoints = $checkPoints . "," . $structure->getRaceTime(); + $checkPoints = $checkPoints . "," . $structure->getLapTime(); - $newRecord->constructNewRecord($player->login, $player->nickname, $structure->getRaceTime(), $checkPoints, true); + $newRecord->constructNewRecord($player->login, $player->nickname, $structure->getLapTime(), $checkPoints, true); if ($this->insertDedimaniaRecord($newRecord, $oldRecord)) { // Get newly saved record @@ -346,7 +346,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene $message = '$390$<$fff' . $notifyName . '$> ' . $improvement . ' $<$ff0' . $newRecord->rank . '.$> Dedimania Record: $<$fff' . Formatter::formatTime($newRecord->best) . '$>'; if (!$oldRecord->nullRecord) { - $message .= ' ($<$ff0' . $oldRecord->rank . '.$> $<$fff-' . Formatter::formatTime(($oldRecord->best - $structure->getRaceTime())) . '$>)'; + $message .= ' ($<$ff0' . $oldRecord->rank . '.$> $<$fff-' . Formatter::formatTime(($oldRecord->best - $structure->getLapTime())) . '$>)'; } if ($newRecord->rank <= $notifyOnlyBestRecords) {