Fixed some stuff in Dedi/Votes
This commit is contained in:
parent
84b44c29b9
commit
3a60897891
@ -314,25 +314,25 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
switch($voteName) {
|
switch($voteName) {
|
||||||
case 'teambalance':
|
case 'teambalance':
|
||||||
$this->maniaControl->client->autoTeamBalance();
|
$this->maniaControl->client->autoTeamBalance();
|
||||||
$this->maniaControl->chat->sendInformation('$s$f8fVote to $fffbalance the teams$f8f has been successfull!');
|
$this->maniaControl->chat->sendInformation('$f8fVote to $fffbalance the teams$f8f has been successfull!');
|
||||||
break;
|
break;
|
||||||
case 'skipmap':
|
case 'skipmap':
|
||||||
case 'skip':
|
case 'skip':
|
||||||
case 'nextmap':
|
case 'nextmap':
|
||||||
$this->maniaControl->client->nextMap();
|
$this->maniaControl->client->nextMap();
|
||||||
$this->maniaControl->chat->sendInformation('$s$f8fVote to $fffskip the map$f8f has been successfull!');
|
$this->maniaControl->chat->sendInformation('$f8fVote to $fffskip the map$f8f has been successfull!');
|
||||||
break;
|
break;
|
||||||
case 'restartmap':
|
case 'restartmap':
|
||||||
$this->maniaControl->client->restartMap();
|
$this->maniaControl->client->restartMap();
|
||||||
$this->maniaControl->chat->sendInformation('$s$f8fVote to $fffrestart the map$f8f has been successfull!');
|
$this->maniaControl->chat->sendInformation('$f8fVote to $fffrestart the map$f8f has been successfull!');
|
||||||
break;
|
break;
|
||||||
case 'pausegame':
|
case 'pausegame':
|
||||||
$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('$f8fVote to $fffpause the current game$f8f has been successfull!');
|
||||||
break;
|
break;
|
||||||
case 'replay':
|
case 'replay':
|
||||||
$this->maniaControl->mapManager->mapQueue->addFirstMapToMapQueue($this->currentVote->voter, $this->maniaControl->mapManager->getCurrentMap());
|
$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!');
|
$this->maniaControl->chat->sendInformation('$f8fVote to $fffreplay the map$f8f has been successfull!');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -441,7 +441,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
if ($this->currentVote->voteCommand->startText != '') {
|
if ($this->currentVote->voteCommand->startText != '') {
|
||||||
$message = $this->currentVote->voteCommand->startText;
|
$message = $this->currentVote->voteCommand->startText;
|
||||||
} else {
|
} else {
|
||||||
$message = '$fff$<' . $player->nickname . '$>$s$f8f started a $fff$<' . $this->currentVote->voteCommand->name . '$>$f8f!';
|
$message = '$fff$<' . $player->nickname . '$>$f8f started a $fff$<' . $this->currentVote->voteCommand->name . '$>$f8f!';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->maniaControl->chat->sendSuccess($message);
|
$this->maniaControl->chat->sendSuccess($message);
|
||||||
|
@ -200,6 +200,9 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu
|
|||||||
* @param \ManiaControl\Players\Player $player
|
* @param \ManiaControl\Players\Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerConnect(Player $player) {
|
public function handlePlayerConnect(Player $player) {
|
||||||
|
if (!$this->init) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Send Dedimania request
|
// Send Dedimania request
|
||||||
$data = array($this->dedimaniaData->sessionId, $player->login, $player->rawNickname, $player->path, $player->isSpectator);
|
$data = array($this->dedimaniaData->sessionId, $player->login, $player->rawNickname, $player->path, $player->isSpectator);
|
||||||
$content = $this->encode_request(self::DEDIMANIA_PLAYERCONNECT, $data);
|
$content = $this->encode_request(self::DEDIMANIA_PLAYERCONNECT, $data);
|
||||||
@ -245,6 +248,9 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu
|
|||||||
* @param \ManiaControl\Players\Player $player
|
* @param \ManiaControl\Players\Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerDisconnect(Player $player) {
|
public function handlePlayerDisconnect(Player $player) {
|
||||||
|
if (!$this->init) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$this->dedimaniaData->removePlayer($player->login);
|
$this->dedimaniaData->removePlayer($player->login);
|
||||||
|
|
||||||
// Send Dedimania request
|
// Send Dedimania request
|
||||||
@ -280,6 +286,9 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu
|
|||||||
* @param $callback
|
* @param $callback
|
||||||
*/
|
*/
|
||||||
public function handleBeginMap($callback) {
|
public function handleBeginMap($callback) {
|
||||||
|
if (!$this->init) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
unset($this->dedimaniaData->records);
|
unset($this->dedimaniaData->records);
|
||||||
$this->fetchDedimaniaRecords(true);
|
$this->fetchDedimaniaRecords(true);
|
||||||
}
|
}
|
||||||
@ -291,6 +300,9 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu
|
|||||||
* @param $callback
|
* @param $callback
|
||||||
*/
|
*/
|
||||||
public function handleMapEnd($callback) {
|
public function handleMapEnd($callback) {
|
||||||
|
if (!$this->init) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!$this->dedimaniaData || !$this->dedimaniaData->records) {
|
if (!$this->dedimaniaData || !$this->dedimaniaData->records) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -369,6 +381,9 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu
|
|||||||
* @param $callback
|
* @param $callback
|
||||||
*/
|
*/
|
||||||
public function updatePlayerList($callback) {
|
public function updatePlayerList($callback) {
|
||||||
|
if (!$this->init) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$serverInfo = $this->getServerInfo();
|
$serverInfo = $this->getServerInfo();
|
||||||
$playerList = $this->getPlayerList();
|
$playerList = $this->getPlayerList();
|
||||||
$votesInfo = $this->getVotesInfo();
|
$votesInfo = $this->getVotesInfo();
|
||||||
@ -409,6 +424,9 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu
|
|||||||
* @param $callback
|
* @param $callback
|
||||||
*/
|
*/
|
||||||
public function handlePlayerCheckpoint($callback) {
|
public function handlePlayerCheckpoint($callback) {
|
||||||
|
if (!$this->init) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$data = $callback[1];
|
$data = $callback[1];
|
||||||
$login = $data[1];
|
$login = $data[1];
|
||||||
$time = $data[2];
|
$time = $data[2];
|
||||||
@ -426,6 +444,9 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu
|
|||||||
* @param $callback
|
* @param $callback
|
||||||
*/
|
*/
|
||||||
public function handlePlayerFinished($callback) {
|
public function handlePlayerFinished($callback) {
|
||||||
|
if (!$this->init) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
//var_dump($callback);
|
//var_dump($callback);
|
||||||
$data = $callback[1];
|
$data = $callback[1];
|
||||||
if ($data[0] <= 0 || $data[2] <= 0) {
|
if ($data[0] <= 0 || $data[2] <= 0) {
|
||||||
@ -598,6 +619,10 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$this->init) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Reset records
|
// Reset records
|
||||||
if ($reset) {
|
if ($reset) {
|
||||||
$this->dedimaniaData->records = array();
|
$this->dedimaniaData->records = array();
|
||||||
@ -923,6 +948,10 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu
|
|||||||
* @return array|RecordData
|
* @return array|RecordData
|
||||||
*/
|
*/
|
||||||
public function getDedimaniaRecords() {
|
public function getDedimaniaRecords() {
|
||||||
|
if (!$this->init) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$this->dedimaniaData->records) {
|
if (!$this->dedimaniaData->records) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user