public function onExplode(EntityExplodeEvent $ev) : void{ $entity = $ev->getEntity(); if(!$entity instanceof PrimedTNT)return; $level = $entity->level; $game = true; foreach ($level->getPlayers() as $player) { if($g = $this->plugin->getPlayerGame($player) !== true){ $game = $g; } } if($game == false)return; $newList = array(); foreach($ev->getBlockList() as $block){ if(in_array(Utils::vectorToString(":", $block->asVector3()), $game->placedBlocks)){ $newList[] = $block; } } $ev->setBlockList($newList); }
You're going to have to be more specific. What error do you get? What's the rest of your code look like?
$game is obviously not what you expect it to be! var_dump($game); to see what you're getting and traceback manually to see where the error lays.
it is the same error i have... here I give more details: https://forums.pmmp.io/threads/error-with-tnt-explode.10512/#post-76176