1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Error with tnt explode

Discussion in 'Plugin Help' started by IvanCraft623, Oct 20, 2020.

  1. IvanCraft623

    IvanCraft623 Baby Zombie

    Messages:
    105
    GitHub:
    IvanCraft623
    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);
        }
     
  2. IvanCraft623

    IvanCraft623 Baby Zombie

    Messages:
    105
    GitHub:
    IvanCraft623
    Utils:vectorToString =
    PHP:
        public static function stringToVector(string $delimeterstring $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]));
        }
     
  3. IvanCraft623

    IvanCraft623 Baby Zombie

    Messages:
    105
    GitHub:
    IvanCraft623
    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){
     
  4. Hoangviphb999

    Hoangviphb999 Silverfish

    Messages:
    21
    GitHub:
    Hoangviphb999
    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
     
  5. QMoon

    QMoon Creeper

    Messages:
    1
    GitHub:
    QMoon10189
    Lol don't share the plugin
     
  6. Hoangviphb999

    Hoangviphb999 Silverfish

    Messages:
    21
    GitHub:
    Hoangviphb999
    Okay ._.
     
  7. IvanCraft623

    IvanCraft623 Baby Zombie

    Messages:
    105
    GitHub:
    IvanCraft623
    ._.
     
  8. ZStarMCZ5487

    ZStarMCZ5487 Creeper

    Messages:
    1
    GitHub:
    ZStarMCZ5487
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.