From 69df3bc84f05f5a64fd2a4d1501b390b155a4f43 Mon Sep 17 00:00:00 2001 From: Max Klaversma Date: Sat, 19 Apr 2014 00:16:19 +0200 Subject: [PATCH] Added extra skip/restart/add commands and added timedifferences to LocalRecords --- application/core/Maps/MapCommands.php | 7 ++++--- application/plugins/LocalRecords.php | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/application/core/Maps/MapCommands.php b/application/core/Maps/MapCommands.php index fa8dff1c..4e0bf455 100644 --- a/application/core/Maps/MapCommands.php +++ b/application/core/Maps/MapCommands.php @@ -44,9 +44,10 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb $this->initActionsMenuButtons(); // Register for admin chat commands - $this->maniaControl->commandManager->registerCommandListener('nextmap', $this, 'command_NextMap', true); - $this->maniaControl->commandManager->registerCommandListener('restartmap', $this, 'command_RestartMap', true); - $this->maniaControl->commandManager->registerCommandListener('addmap', $this, 'command_AddMap', true); + $this->maniaControl->commandManager->registerCommandListener(array('nextmap', 'next', 'skip'), $this, 'command_NextMap', true); + $this->maniaControl->commandManager->registerCommandListener('skip', $this, 'command_NextMap', true); + $this->maniaControl->commandManager->registerCommandListener(array('restartmap', 'resmap', 'res'), $this, 'command_RestartMap', true); + $this->maniaControl->commandManager->registerCommandListener(array('addmap', 'add'), $this, 'command_AddMap', true); $this->maniaControl->commandManager->registerCommandListener(array('removemap', 'removethis', 'erasemap', 'erasethis'), $this, 'command_RemoveMap', true); $this->maniaControl->commandManager->registerCommandListener(array('shufflemaps', 'shuffle'), $this, 'command_ShuffleMaps', true); diff --git a/application/plugins/LocalRecords.php b/application/plugins/LocalRecords.php index 40768de1..2c4e720b 100644 --- a/application/plugins/LocalRecords.php +++ b/application/plugins/LocalRecords.php @@ -281,12 +281,16 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList $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) { - $improvement = ((!$oldRecord || $newRecord->rank < $oldRecord->rank) ? 'gained the' : 'improved Your'); + $improvement = ((!$oldRecord || $newRecord->rank < $oldRecord->rank) ? 'gained the' : 'improved your'); $message = 'You ' . $improvement . ' $<$o' . $newRecord->rank . '.$> Local Record: ' . Formatter::formatTime($newRecord->time); + if($oldRecord) $oldRank = ($improvement == 'improved your') ? '' : $oldRecord->rank.'. '; + if($oldRecord) $message .= ' ('.$oldRank.'-'.Formatter::formatTime(($oldRecord->time-$newRecord->time)).')'; $this->maniaControl->chat->sendInformation($message, $player->login); } else { $improvement = ((!$oldRecord || $newRecord->rank < $oldRecord->rank) ? 'gained the' : 'improved the'); $message = '$<' . $player->nickname . '$> ' . $improvement . ' $<$o' . $newRecord->rank . '.$> Local Record: ' . Formatter::formatTime($newRecord->time); + if($oldRecord) $oldRank = ($improvement == 'improved the') ? '' : $oldRecord->rank.'. '; + if($oldRecord) $message .= ' ('.$oldRank.'-'.Formatter::formatTime(($oldRecord->time-$newRecord->time)).')'; $this->maniaControl->chat->sendInformation($message); } }