PHP: [15:34:14] critical> "Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'Jump v1.0.0': Call to a member function getText() on null on JackboyPlay\Jump\Main[15:34:14]critical> Error: "Call to a member function getText() on null" (EXCEPTION) in "/Jump/src/JackboyPlay/Jump/Main" at line 93 Whats the error? Here the function: PHP: public function onSchildKlick(PlayerInteractEvent $event){$player = $event->getPlayer();$block = $event->getBlock();$tile = $event->getPlayer()->getLevel()->getTile($block); $text = $tile->getText();if($tile instanceof Sign){if($text[0] == "§c[§aJump§c]" && $text[2] == "§eLobby" && $text[3] == "§fJump1"){$this->jump1[$player->getName()] = true;$player->sendMessage("§7[§eJump§7] §aDu hast das Spiel §cJump1§a betreten!");}}}
Use this sorry for my mistake PHP: if($event->getBlock()->getId() == 68 || $event->getBlock()->getId() == 63) { $sign = $event->getPlayer()->getLevel()->getTile($event->getBlock()); if($sign instanceof Sign) { $text = $sign->getText(); if($text[0] == "[Test]"){
Always remember that PHP code in a function is run from left to right, from up to down. The code above is executed before the code below. Code before an if-block is executed whether the if-block behind it is executed or not. You executed $tile->getText() without checking $tile !== null, so there is a chance that you are executing $tile->getText() when $tile is null.
You have an deeply ironic-notfunny-good-useful way of explaining things this makes my brain explode about whether i should HATE you or fucking LOVE you