Added replay votes + admin replay
This commit is contained in:
parent
e6fdb070a1
commit
74d963cca5
@ -46,6 +46,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
// Register for admin chat commands
|
// Register for admin chat commands
|
||||||
$this->maniaControl->commandManager->registerCommandListener(array('nextmap', 'next', 'skip'), $this, 'command_NextMap', true);
|
$this->maniaControl->commandManager->registerCommandListener(array('nextmap', 'next', 'skip'), $this, 'command_NextMap', true);
|
||||||
$this->maniaControl->commandManager->registerCommandListener(array('restartmap', 'resmap', 'res'), $this, 'command_RestartMap', true);
|
$this->maniaControl->commandManager->registerCommandListener(array('restartmap', 'resmap', 'res'), $this, 'command_RestartMap', true);
|
||||||
|
$this->maniaControl->commandManager->registerCommandListener(array('replaymap', 'replay'), $this, 'command_ReplayMap', true);
|
||||||
$this->maniaControl->commandManager->registerCommandListener(array('addmap', 'add'), $this, 'command_AddMap', 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('removemap', 'removethis', 'erasemap', 'erasethis'), $this, 'command_RemoveMap', true);
|
||||||
$this->maniaControl->commandManager->registerCommandListener(array('shufflemaps', 'shuffle'), $this, 'command_ShuffleMaps', true);
|
$this->maniaControl->commandManager->registerCommandListener(array('shufflemaps', 'shuffle'), $this, 'command_ShuffleMaps', true);
|
||||||
@ -215,6 +216,25 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////$this->maniaControl->mapManager->mapQueue->addFirstMapToMapQueue($this->currentVote->voter, $this->maniaControl->mapManager->getCurrentMap());
|
||||||
|
/**
|
||||||
|
* Handle replaymap command
|
||||||
|
*
|
||||||
|
* @param array $chat
|
||||||
|
* @param \ManiaControl\Players\Player $player
|
||||||
|
*/
|
||||||
|
public function command_ReplayMap(array $chat, Player $player) {
|
||||||
|
if (!$this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_RESTART_MAP)) {
|
||||||
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$message = '$<' . $player->nickname . '$> replays the current Map!';
|
||||||
|
$this->maniaControl->chat->sendSuccess($message);
|
||||||
|
$this->maniaControl->log($message, true);
|
||||||
|
|
||||||
|
$this->maniaControl->mapManager->mapQueue->addFirstMapToMapQueue($player, $this->maniaControl->mapManager->getCurrentMap());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle /maps command
|
* Handle /maps command
|
||||||
*
|
*
|
||||||
|
@ -91,6 +91,16 @@ class MapQueue implements CallbackListener, CommandListener {
|
|||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('clear'));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('clear'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addFirstMapToMapQueue($player, $map) {
|
||||||
|
if ($map) {
|
||||||
|
if (array_key_exists($map->uid, $this->queuedMaps)) {
|
||||||
|
unset($this->queuedMaps[$map->uid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
array_unshift($this->queuedMaps, array($player, $map));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a Map to the map-queue
|
* Adds a Map to the map-queue
|
||||||
|
@ -136,6 +136,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$this->defineVote("restartmap", "Vote for Restart Map");
|
$this->defineVote("restartmap", "Vote for Restart Map");
|
||||||
$this->defineVote("restart", "Vote for Restart Map");
|
$this->defineVote("restart", "Vote for Restart Map");
|
||||||
$this->defineVote("pausegame", "Vote for Pause Game");
|
$this->defineVote("pausegame", "Vote for Pause Game");
|
||||||
|
$this->defineVote("replay", "Vote to replay current map");
|
||||||
|
|
||||||
foreach($this->voteCommands as $name => $voteCommand) {
|
foreach($this->voteCommands as $name => $voteCommand) {
|
||||||
$this->maniaControl->commandManager->registerCommandListener($name, $this, 'handleChatVote');
|
$this->maniaControl->commandManager->registerCommandListener($name, $this, 'handleChatVote');
|
||||||
@ -330,6 +331,10 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$this->maniaControl->client->sendModeScriptCommands(array('Command_ForceWarmUp' => True));
|
$this->maniaControl->client->sendModeScriptCommands(array('Command_ForceWarmUp' => True));
|
||||||
$this->maniaControl->chat->sendInformation('$s$f8fVote to $fffpause the current game$f8f has been successfull!');
|
$this->maniaControl->chat->sendInformation('$s$f8fVote to $fffpause the current game$f8f has been successfull!');
|
||||||
break;
|
break;
|
||||||
|
case 'replay':
|
||||||
|
$this->maniaControl->mapManager->mapQueue->addFirstMapToMapQueue($this->currentVote->voter, $this->maniaControl->mapManager->getCurrentMap());
|
||||||
|
$this->maniaControl->chat->sendInformation('$s$f8fVote to $fffreplay the map$f8f has been successfull!');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->maniaControl->chat->sendError('Vote Failed!');
|
$this->maniaControl->chat->sendError('Vote Failed!');
|
||||||
|
Loading…
Reference in New Issue
Block a user