| @@ 7-24 (lines=18) @@ | ||
| 4 | ||
| 5 | use eXpansion\Core\Storage\Data\Player; |
|
| 6 | ||
| 7 | class Players extends Spectators |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * @inheritdoc |
|
| 11 | */ |
|
| 12 | public function onPlayerConnect(Player $player) |
|
| 13 | { |
|
| 14 | if (!$player->isSpectator()) { |
|
| 15 | $this->userGroup->addLogin($player->getLogin()); |
|
| 16 | } |
|
| 17 | } |
|
| 18 | ||
| 19 | public function onPlayerInfoChanged(Player $oldPlayer, Player $player) |
|
| 20 | { |
|
| 21 | $this->userGroup->removeLogin($player->getLogin()); |
|
| 22 | $this->onPlayerConnect($player); |
|
| 23 | } |
|
| 24 | } |
|
| @@ 7-26 (lines=20) @@ | ||
| 4 | ||
| 5 | use eXpansion\Core\Storage\Data\Player; |
|
| 6 | ||
| 7 | class Spectators extends AbstractUserGroupPlugin |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * @inheritdoc |
|
| 11 | */ |
|
| 12 | public function onPlayerConnect(Player $player) |
|
| 13 | { |
|
| 14 | if ($player->isSpectator()) { |
|
| 15 | $this->userGroup->addLogin($player->getLogin()); |
|
| 16 | } |
|
| 17 | } |
|
| 18 | ||
| 19 | public function onPlayerInfoChanged(Player $oldPlayer, Player $player) |
|
| 20 | { |
|
| 21 | $this->userGroup->removeLogin($player->getLogin()); |
|
| 22 | $this->onPlayerConnect($player); |
|
| 23 | ||
| 24 | parent::onPlayerInfoChanged($oldPlayer, $player); |
|
| 25 | } |
|
| 26 | } |
|