moved the endrounds to the new plugin
This commit is contained in:
parent
9ff8989a00
commit
fb5e7b3d96
@ -23,7 +23,7 @@ use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
|
|||||||
class ModeScriptEventManager implements UsageInformationAble {
|
class ModeScriptEventManager implements UsageInformationAble {
|
||||||
use UsageInformationTrait;
|
use UsageInformationTrait;
|
||||||
|
|
||||||
const API_VERSION = "2.0.0";
|
const API_VERSION = "2.1.0";
|
||||||
|
|
||||||
/** @var ManiaControl $maniaControl */
|
/** @var ManiaControl $maniaControl */
|
||||||
private $maniaControl;
|
private $maniaControl;
|
||||||
|
@ -40,7 +40,6 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer
|
|||||||
const SETTING_PERMISSION_SHOW_SYSTEMINFO = 'Show SystemInfo';
|
const SETTING_PERMISSION_SHOW_SYSTEMINFO = 'Show SystemInfo';
|
||||||
const SETTING_PERMISSION_SHUTDOWN_SERVER = 'Shutdown Server';
|
const SETTING_PERMISSION_SHUTDOWN_SERVER = 'Shutdown Server';
|
||||||
const SETTING_PERMISSION_CHANGE_SERVERSETTINGS = 'Change ServerSettings';
|
const SETTING_PERMISSION_CHANGE_SERVERSETTINGS = 'Change ServerSettings';
|
||||||
const SETTING_PERMISSION_END_ROUND = 'Force end of current Trackmania Round';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Private properties
|
* Private properties
|
||||||
@ -103,11 +102,6 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer
|
|||||||
|
|
||||||
$this->updateCancelVoteMenuItem();
|
$this->updateCancelVoteMenuItem();
|
||||||
$this->updateWarmUpMenuItems();
|
$this->updateWarmUpMenuItems();
|
||||||
|
|
||||||
if ($this->maniaControl->getMapManager()->getCurrentMap()->getGame() === 'tm') {
|
|
||||||
$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_END_ROUND, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
|
||||||
$this->maniaControl->getCommandManager()->registerCommandListener(array('endround', 'end'), $this, 'commandTrackManiaEndRound', true, 'Ends the Current Round.');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -459,20 +453,4 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer
|
|||||||
$this->maniaControl->getClient()->setMaxSpectators($amount);
|
$this->maniaControl->getClient()->setMaxSpectators($amount);
|
||||||
$this->maniaControl->getChat()->sendSuccess("Changed max spectators to: {$amount}", $player);
|
$this->maniaControl->getChat()->sendSuccess("Changed max spectators to: {$amount}", $player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle //endround command
|
|
||||||
*
|
|
||||||
* @param array $chatCallback
|
|
||||||
* @param \ManiaControl\Players\Player $player
|
|
||||||
*/
|
|
||||||
public function commandTrackManiaEndRound(array $chatCallback, Player $player) {
|
|
||||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_END_ROUND)) {
|
|
||||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->maniaControl->getModeScriptEventManager()->forceTrackmaniaRoundEnd();
|
|
||||||
$this->maniaControl->getChat()->sendSuccess($player->getEscapedNickname() . ' forced end of the Round!');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ use ManiaControl\Players\Player;
|
|||||||
use ManiaControl\Plugins\Plugin;
|
use ManiaControl\Plugins\Plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ManiaControl ServerRanking Plugin
|
* ManiaControl Trackmania Rounds Plugin
|
||||||
*
|
*
|
||||||
* @author ManiaControl Team <mail@maniacontrol.com>
|
* @author ManiaControl Team <mail@maniacontrol.com>
|
||||||
* @copyright 2014-2017 ManiaControl Team
|
* @copyright 2014-2017 ManiaControl Team
|
||||||
@ -27,7 +27,8 @@ class TrackmaniaRoundsPlugin implements Plugin, CommandListener {
|
|||||||
|
|
||||||
const MAX_POINT_DISTRIBUTIONS = 8;
|
const MAX_POINT_DISTRIBUTIONS = 8;
|
||||||
|
|
||||||
const SETTING_PERMISSION_TM_HANDLE_POINTS_REPARTITION = 'Handle Points Distribution Settings';
|
const SETTING_PERMISSION_TM_HANDLE_POINTS_REPARTITION = 'Permission handle Points Distribution Settings';
|
||||||
|
const SETTING_PERMISSION_END_ROUND = 'Permission Force end of current Trackmania Round';
|
||||||
const SETTING_POINT_DISTRIBUTION_NAME = 'Server Distribution Name ';
|
const SETTING_POINT_DISTRIBUTION_NAME = 'Server Distribution Name ';
|
||||||
const SETTING_POINT_DISTRIBUTION_VALUE = 'Server Distribution Value ';
|
const SETTING_POINT_DISTRIBUTION_VALUE = 'Server Distribution Value ';
|
||||||
|
|
||||||
@ -52,6 +53,7 @@ class TrackmaniaRoundsPlugin implements Plugin, CommandListener {
|
|||||||
|
|
||||||
//Authentication Permission Level
|
//Authentication Permission Level
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_PERMISSION_TM_HANDLE_POINTS_REPARTITION, AuthenticationManager::getPermissionLevelNameArray(AuthenticationManager::AUTH_LEVEL_ADMIN));
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_PERMISSION_TM_HANDLE_POINTS_REPARTITION, AuthenticationManager::getPermissionLevelNameArray(AuthenticationManager::AUTH_LEVEL_ADMIN));
|
||||||
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_PERMISSION_END_ROUND, AuthenticationManager::getPermissionLevelNameArray(AuthenticationManager::AUTH_LEVEL_MODERATOR));
|
||||||
|
|
||||||
//Settings
|
//Settings
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_POINT_DISTRIBUTION_NAME . 1, "motogp");
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_POINT_DISTRIBUTION_NAME . 1, "motogp");
|
||||||
@ -62,11 +64,14 @@ class TrackmaniaRoundsPlugin implements Plugin, CommandListener {
|
|||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_POINT_DISTRIBUTION_VALUE . $i, "");
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_POINT_DISTRIBUTION_VALUE . $i, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
$this->maniaControl->getCommandManager()->registerCommandListener(array('setrpoints',
|
$this->maniaControl->getCommandManager()->registerCommandListener(array('setrpoints',
|
||||||
'setpointsdistribution'), $this, 'commandSetPointsRepartition', true, 'Sets the Rounds Point Repartition.');
|
'setpointsdistribution'), $this, 'commandSetPointsRepartition', true, 'Sets the Rounds Point Repartition.');
|
||||||
$this->maniaControl->getCommandManager()->registerCommandListener(array('getrpoints',
|
$this->maniaControl->getCommandManager()->registerCommandListener(array('getrpoints',
|
||||||
'getpointsdistribution'), $this, 'commandGetPointsRepartition', true, 'Gets the Rounds Point Repartition.');
|
'getpointsdistribution'), $this, 'commandGetPointsRepartition', true, 'Gets the Rounds Point Repartition.');
|
||||||
|
$this->maniaControl->getCommandManager()->registerCommandListener(array('endround', 'end'), $this, 'commandTrackManiaEndRound', true, 'Ends the Current Round.');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,6 +138,23 @@ class TrackmaniaRoundsPlugin implements Plugin, CommandListener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle //endround command
|
||||||
|
*
|
||||||
|
* @param array $chatCallback
|
||||||
|
* @param \ManiaControl\Players\Player $player
|
||||||
|
*/
|
||||||
|
public function commandTrackManiaEndRound(array $chatCallback, Player $player) {
|
||||||
|
$permission = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_PERMISSION_END_ROUND);
|
||||||
|
if (!AuthenticationManager::checkRight($player, $permission)) {
|
||||||
|
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->maniaControl->getModeScriptEventManager()->forceTrackmaniaRoundEnd();
|
||||||
|
$this->maniaControl->getChat()->sendSuccess($player->getEscapedNickname() . ' forced end of the Round!');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \ManiaControl\Plugins\Plugin::getId()
|
* @see \ManiaControl\Plugins\Plugin::getId()
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user