fixed forcetoplay
This commit is contained in:
parent
8dfed19991
commit
8df21859a0
@ -67,9 +67,11 @@ class PlayerActions {
|
|||||||
*
|
*
|
||||||
* @param string $adminLogin
|
* @param string $adminLogin
|
||||||
* @param string $targetLogin
|
* @param string $targetLogin
|
||||||
* @param int $type
|
* @param bool $userIsAbleToSelect
|
||||||
|
* @param bool $displayAnnouncement
|
||||||
|
* @internal param int $type
|
||||||
*/
|
*/
|
||||||
public function forcePlayerToPlay($adminLogin, $targetLogin, $type = 2) {
|
public function forcePlayerToPlay($adminLogin, $targetLogin, $userIsAbleToSelect = true, $displayAnnouncement = true) {
|
||||||
$admin = $this->maniaControl->playerManager->getPlayer($adminLogin);
|
$admin = $this->maniaControl->playerManager->getPlayer($adminLogin);
|
||||||
if(!$this->maniaControl->authenticationManager->checkPermission($admin, self::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) {
|
if(!$this->maniaControl->authenticationManager->checkPermission($admin, self::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) {
|
||||||
$this->maniaControl->authenticationManager->sendNotAllowed($admin);
|
$this->maniaControl->authenticationManager->sendNotAllowed($admin);
|
||||||
@ -80,15 +82,25 @@ class PlayerActions {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$success = $this->maniaControl->client->query('ForceSpectator', $target->login, ($type != 1 ? 0 : 2));
|
$success = $this->maniaControl->client->query('ForceSpectator', $target->login, self::SPECTATOR_PLAYER);
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $admin->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $admin->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($userIsAbleToSelect) {
|
||||||
|
$success = $this->maniaControl->client->query('ForceSpectator', $target->login, self::SPECTATOR_USER_SELECTABLE);
|
||||||
|
if(!$success) {
|
||||||
|
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $admin->login);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Announce force
|
// Announce force
|
||||||
$chatMessage = '$<' . $admin->nickname . '$> forced $<' . $target->nickname . '$> to Play!';
|
if($displayAnnouncement) {
|
||||||
$this->maniaControl->chat->sendInformation($chatMessage);
|
$chatMessage = '$<' . $admin->nickname . '$> forced $<' . $target->nickname . '$> to Play!';
|
||||||
|
$this->maniaControl->chat->sendInformation($chatMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,11 +122,7 @@ class PlayerActions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($target->isSpectator) {
|
if($target->isSpectator) {
|
||||||
$success = $this->maniaControl->client->query('ForceSpectator', $target->login, self::SPECTATOR_PLAYER);
|
$this->forcePlayerToPlay($adminLogin, $targetLogin, true, false);
|
||||||
if(!$success) {
|
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $admin->login);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$success = $this->maniaControl->client->query('ForcePlayerTeam', $target->login, $teamId);
|
$success = $this->maniaControl->client->query('ForcePlayerTeam', $target->login, $teamId);
|
||||||
|
@ -178,7 +178,12 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
|
|||||||
if(isset($params[2]) && is_numeric($params[2])) {
|
if(isset($params[2]) && is_numeric($params[2])) {
|
||||||
$type = intval($params[2]);
|
$type = intval($params[2]);
|
||||||
}
|
}
|
||||||
$this->maniaControl->playerManager->playerActions->forcePlayerToPlay($player->login, $targetLogin, $type);
|
$selectable = false;
|
||||||
|
if($type == 2) {
|
||||||
|
$selectable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->maniaControl->playerManager->playerActions->forcePlayerToPlay($player->login, $targetLogin, $selectable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user