PHP: public function queue(Player $player) { if (empty($this->alr[$player->getUniqueId()->toString()])) { $this->queue[] = $player->getName(); $this->alr[$player->getUniqueId()->toString()] = true; } } PHP: public function onInteract(PlayerInteractEvent $event) { $player = $event->getPlayer(); $inst = ItemFactory::getInstance(); $it = VanillaItems::DIAMOND(); $form = new SimpleForm(function (Player $player, int $data = null){ $result = $data; if($result === null){ // Closed form without submitting return; } switch($result){ case 0: $this->queue($player); if (count($this->queue) == 2) { $arr = array_shift($this->queue); $player1 = $this->getServer()->getPlayerExact($this->queue[0]); $player2 = $this->getServer()->getPlayerExact($this->queue[1]); if ($player1 instanceof Player || $player2 instanceof Player) { $player2->sendMessage("lmao"); $player1->sendMessage("zzz"); } } print_r(count($this->queue)); $player->sendMessage("a"); print_r($this->queue); break; } }); $form->addButton("Duels"); $form->setTitle("Play"); if ($event->getItem() == $it) { $this->getLogger()->info("worked!"); $form->sendToPlayer($player); } } undefined array key 1 on line 54 ( $player2 = $this->getServer()->getPlayerExact($this->queue[1]); )