From 9d0677364e1787b0ae9653c687c0645c750d4e89 Mon Sep 17 00:00:00 2001 From: jonthekiller Date: Mon, 15 Jul 2019 21:25:49 +0200 Subject: [PATCH 1/2] Add //endwu to be able to stop a WarmUp Adding //endwu command to be able to stop the WarmUp in progress. --- plugins/MCTeam/TrackmaniaRoundsPlugin.php | 24 +++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/plugins/MCTeam/TrackmaniaRoundsPlugin.php b/plugins/MCTeam/TrackmaniaRoundsPlugin.php index c5ee48e2..cd60b9b0 100644 --- a/plugins/MCTeam/TrackmaniaRoundsPlugin.php +++ b/plugins/MCTeam/TrackmaniaRoundsPlugin.php @@ -13,7 +13,7 @@ use ManiaControl\Plugins\Plugin; * ManiaControl Trackmania Rounds Plugin * * @author ManiaControl Team - * @copyright 2014-2019 ManiaControl Team + * @copyright 2014-2018 ManiaControl Team * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 */ class TrackmaniaRoundsPlugin implements Plugin, CommandListener { @@ -21,7 +21,7 @@ class TrackmaniaRoundsPlugin implements Plugin, CommandListener { * Constants */ const PLUGIN_ID = 6; - const PLUGIN_VERSION = 0.11; + const PLUGIN_VERSION = 0.12; const PLUGIN_NAME = 'Trackmania Rounds Plugin'; const PLUGIN_AUTHOR = 'MCTeam'; @@ -71,6 +71,7 @@ class TrackmaniaRoundsPlugin implements Plugin, CommandListener { $this->maniaControl->getCommandManager()->registerCommandListener(array('getrpoints', 'getpointsdistribution'), $this, 'commandGetPointsRepartition', true, 'Gets the Rounds Point Repartition.'); $this->maniaControl->getCommandManager()->registerCommandListener(array('endround', 'end'), $this, 'commandTrackManiaEndRound', true, 'Ends the Current Round.'); + $this->maniaControl->getCommandManager()->registerCommandListener('endwu', $this, 'commandTrackManiaEndWarmUp', true, 'Ends the Current WarmUp.'); } @@ -149,6 +150,25 @@ class TrackmaniaRoundsPlugin implements Plugin, CommandListener { $this->maniaControl->getChat()->sendSuccess($player->getEscapedNickname() . ' forced end of the Round!'); } + /** + * Handle //endwu command + * + * @param array $chatCallback + * @param \ManiaControl\Players\Player $player + */ + public function commandTrackManiaEndWarmUp(array $chatCallback, Player $player) { + $permission = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_PERMISSION_END_ROUND); + if (!AuthenticationManager::checkRight($player, AuthenticationManager::getAuthLevel($permission))) { + $this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); + return; + } + + try { + $this->maniaControl->getModeScriptEventManager()->triggerModeScriptEvent("Trackmania.WarmUp.ForceStop"); + } catch (\Throwable $e) { + } + $this->maniaControl->getChat()->sendSuccess($player->getEscapedNickname() . ' forced end of the WarmUp!'); + } /** * @see \ManiaControl\Plugins\Plugin::getId() */ From e3dd2599eebc31fa9017433df237c38cd7748d04 Mon Sep 17 00:00:00 2001 From: jonthekiller Date: Mon, 15 Jul 2019 21:26:47 +0200 Subject: [PATCH 2/2] Fix Copyright date --- plugins/MCTeam/TrackmaniaRoundsPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/MCTeam/TrackmaniaRoundsPlugin.php b/plugins/MCTeam/TrackmaniaRoundsPlugin.php index cd60b9b0..84d97040 100644 --- a/plugins/MCTeam/TrackmaniaRoundsPlugin.php +++ b/plugins/MCTeam/TrackmaniaRoundsPlugin.php @@ -13,7 +13,7 @@ use ManiaControl\Plugins\Plugin; * ManiaControl Trackmania Rounds Plugin * * @author ManiaControl Team - * @copyright 2014-2018 ManiaControl Team + * @copyright 2014-2019 ManiaControl Team * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 */ class TrackmaniaRoundsPlugin implements Plugin, CommandListener {