Hi guys, it's been a while since I stopped her and I just came back and here's the problem Code: [13:42:21] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerQuitEvent' to 'Skywars-Pro v1.0.0': Undefined index: Praxthisnovcht on Skywars\Main [13:42:21] [Server thread/NOTICE]: ArrayOutOfBoundsException: "Undefined index: Praxthisnovcht" (E_NOTICE) in "/Skywars-Pro_v1.0.0/src/Skywars/Main" at line 878 PHP: public function onPlayerQuit(PlayerQuitEvent $event){ $player = $event->getPlayer()->getName(); $p = $event->getPlayer(); $id = $this->gamePlayers[$player]; # Lines 878 ERROR --$this->playersInArena[$id]; for($n = 1; $n <=4; $n++) { if(isset($this->pod[$id . "-" . $n]) && $this->pod[$id . "-" . $n] == $player) { unset($this->pod[$id . "-" . $n]); } } }
Is $player set with a value in the array $gamePlayers ? That error is caused because $gamePlayers[$player] isn't indexed in the array. I believe.
PlayerJoinEvent, PlayerLoginEgent and even PlayerPreLoginEvent may not be fired before PlayerQuitEvent if player quits before he correctly joins. For example, if he joins with an invalid name.