nextmap command
This commit is contained in:
parent
d79b6fb102
commit
a286655da5
@ -49,6 +49,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
$this->maniaControl->commandManager->registerCommandListener(array('shufflemaps', 'shuffle'), $this, 'command_ShuffleMaps', true);
|
$this->maniaControl->commandManager->registerCommandListener(array('shufflemaps', 'shuffle'), $this, 'command_ShuffleMaps', true);
|
||||||
|
|
||||||
// Register for player chat commands
|
// Register for player chat commands
|
||||||
|
$this->maniaControl->commandManager->registerCommandListener('nextmap', $this, 'command_showNextMap');
|
||||||
$this->maniaControl->commandManager->registerCommandListener(array('maps', 'list'), $this, 'command_List');
|
$this->maniaControl->commandManager->registerCommandListener(array('maps', 'list'), $this, 'command_List');
|
||||||
$this->maniaControl->commandManager->registerCommandListener(array('xmaps', 'xlist'), $this, 'command_xList');
|
$this->maniaControl->commandManager->registerCommandListener(array('xmaps', 'xlist'), $this, 'command_xList');
|
||||||
|
|
||||||
@ -89,6 +90,29 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
$this->maniaControl->actionsMenu->addAdminMenuItem($itemQuad, 2, 'Skip Map');
|
$this->maniaControl->actionsMenu->addAdminMenuItem($itemQuad, 2, 'Skip Map');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows which map is the next
|
||||||
|
*
|
||||||
|
* @param array $chat
|
||||||
|
* @param Player $player
|
||||||
|
*/
|
||||||
|
public function command_ShowNextMap(array $chat, Player $player) {
|
||||||
|
$nextQueued = $this->maniaControl->mapManager->mapQueue->getNextQueuedMap();
|
||||||
|
if($nextQueued != null) {
|
||||||
|
/** @var Player $requester */
|
||||||
|
$requester = $nextQueued[0];
|
||||||
|
/** @var Map $map */
|
||||||
|
$map = $nextQueued[1];
|
||||||
|
$this->maniaControl->chat->sendInformation("Next map is $<" . $map->name . "$> from $<" . $map->authorNick . "$> requested by $<" . $requester->nickname . "$>.", $player->login);
|
||||||
|
} else {
|
||||||
|
$this->maniaControl->client->query('GetNextMapIndex');
|
||||||
|
$mapIndex = $this->maniaControl->client->getResponse();
|
||||||
|
$maps = $this->maniaControl->mapManager->getMaps();
|
||||||
|
$map = $maps[$mapIndex];
|
||||||
|
$this->maniaControl->chat->sendInformation("Next map is $<" . $map->name . "$> from $<" . $map->authorNick . "$>.", $player->login);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle removemap command
|
* Handle removemap command
|
||||||
*
|
*
|
||||||
|
@ -169,6 +169,20 @@ class MapQueue implements CallbackListener, CommandListener {
|
|||||||
return $this->nextMap;
|
return $this->nextMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the first Queued Map
|
||||||
|
*
|
||||||
|
* @return array(Player $player, Map $map)
|
||||||
|
*/
|
||||||
|
public function getNextQueuedMap() {
|
||||||
|
foreach($this->queuedMaps as $queuedMap) {
|
||||||
|
//return the first Queued Map
|
||||||
|
return $queuedMap;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list with the indexes of the queued maps
|
* Returns a list with the indexes of the queued maps
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user