fixed queue
This commit is contained in:
parent
0f9fac1613
commit
533e79e55d
@ -15,6 +15,7 @@ use ManiaControl\Callbacks\TimerListener;
|
|||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
|
use ManiaControl\Players\PlayerActions;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
use ManiaControl\Plugins\Plugin;
|
use ManiaControl\Plugins\Plugin;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
||||||
@ -330,13 +331,14 @@ class QueuePlugin implements CallbackListener, ManialinkPageAnswerListener, Time
|
|||||||
* @param Player $player
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
private function forcePlayerToPlay(Player $player) {
|
private function forcePlayerToPlay(Player $player) {
|
||||||
|
//FIXME players get sometimes forced into bigger team
|
||||||
if ($this->maniaControl->client->getServerPassword() != false && $this->maniaControl->settingManager->getSettingValue($this, self::QUEUE_ACTIVE_ON_PASS) == false) {
|
if ($this->maniaControl->client->getServerPassword() != false && $this->maniaControl->settingManager->getSettingValue($this, self::QUEUE_ACTIVE_ON_PASS) == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->maxPlayers > (count($this->maniaControl->playerManager->players) - count($this->spectators))) {
|
if ($this->maxPlayers > $this->maniaControl->playerManager->getPlayerCount(true)) {
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forceSpectator($player->login, 2);
|
$this->maniaControl->client->forceSpectator($player->login, PlayerActions::SPECTATOR_PLAYER);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
|
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
|
||||||
$this->maniaControl->chat->sendError("Error while leaving the Queue", $player->login);
|
$this->maniaControl->chat->sendError("Error while leaving the Queue", $player->login);
|
||||||
@ -344,7 +346,7 @@ class QueuePlugin implements CallbackListener, ManialinkPageAnswerListener, Time
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forceSpectator($player->login, 0);
|
$this->maniaControl->client->forceSpectator($player->login, PlayerActions::SPECTATOR_USER_SELECTABLE);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
|
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
|
||||||
}
|
}
|
||||||
@ -376,9 +378,8 @@ class QueuePlugin implements CallbackListener, ManialinkPageAnswerListener, Time
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->maniaControl->errorHandler->triggerDebugNotice("Smallest Team " . $smallestTeam . " Smallest Size " . $smallestSize . " Teamcount " . count($teams));
|
|
||||||
try {
|
try {
|
||||||
if ($smallestTeam) {
|
if ($smallestTeam !== null) {
|
||||||
$this->maniaControl->client->forcePlayerTeam($player->login, $smallestTeam);
|
$this->maniaControl->client->forcePlayerTeam($player->login, $smallestTeam);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user