I have installed a BedWars plugin but when triggering a tnt in the game this happens: Error code: Code: ErrorException: "Trying to get property 'placedBlocks' of non-object" (EXCEPTION) in "plugins/BedWars_v1.phar/src/BedWars/game/GameListener" at line 113 PHP Code: PHP: public function onExplode(EntityExplodeEvent $ev) : void{ $entity = $ev->getEntity(); if(!$entity instanceof PrimedTNT)return; $level = $entity->level; $game = null; foreach ($level->getPlayers() as $player) { if($g = $this->plugin->getPlayerGame($player) !== null){ $game = $g; } } if($game == null)return; $newList = array(); foreach($ev->getBlockList() as $block){ if(in_array(Utils::vectorToString(":", $block->asVector3()), $game->placedBlocks)){ //Error Line $newList[] = $block; } } $ev->setBlockList($newList); }
Utils:vectorToString = PHP: public static function stringToVector(string $delimeter, string $string, &$yaw = 0.0, &$pitch = 0.0) : Vector3{ $split = explode($delimeter, $string); if(isset($split[3]) && isset($split[4])){ $yaw = floatval($split[3]); $pitch = floatval($split[4]); } return new Vector3(intval($split[0]), intval($split[1]), intval($split[2])); }
Hi guys if someone happens the same and wants to know how I have solved: Change this: PHP: if($g = $this->plugin->getPlayerGame($player) !== null){ To this: PHP: if(($g = $this->plugin->getPlayerGame($player)) !== null){
Yeah but now i have Hydren Bedwars plugins, tnt is not breaking block cuz that is really important and if u want to set some block for TNT break, non ui just like dev-8 and everything fixed. I will share this plugins. Contact me on Discord for Bedwars plugins free: @sunshroom_chan#7887