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

Solved Help me fast guys I need this plugin so much

Discussion in 'Plugin Help' started by Ayush, Mar 22, 2021.

  1. Ayush

    Ayush Witch

    Messages:
    62
    Hi,
    I am making a plugin and an error occurred the error is
    PHP:
    2021-03-21 [12:00:02] [Server thread/CRITICAL]: Error"Call to a member function spawnToAll() on null" (EXCEPTIONin "plugins/⚔Boss.phar/src/Boss/Loader" at line 189
    And the code is:-
    PHP:
        public function onInteract(PlayerInteractEvent $event) : void{
            
    $item $event->getItem();
            
    $block $event->getBlock();
            if(
    $item instanceof SpawnEgg){
                if(isset(
    self::EGG_LIST[$item->getDamage()])){
                    
    $bossName self::EGG_LIST[$item->getDamage()];
                    
    $nbt Entity::createBaseNBT(new Vector3($block->getX(), $block->getY() + 1.5$block->getZ()));;
                    
    $bossEntity Entity::createEntity("Zeus"$event->getPlayer()->level$nbt);
                    
    $bossEntity->spawnToAll();
                    if(
    $bossEntity instanceof ZeusBoss){
                        
    $bossEntity->setAnAdult();
                    }
                    
    $this->registredEntities[$bossEntity->getId()] = $bossEntity;
                }
            }
        }[/
    B]
     
  2. Primus

    Primus Zombie Pigman

    Messages:
    749
    Apparently entity with the name "Zeus" is not registered.
     
    Ayush and mmm545 like this.
  3. Ayush

    Ayush Witch

    Messages:
    62
    Ok I am fix it thx btw
     
  4. Ayush

    Ayush Witch

    Messages:
    62
    So how I should register the entity here
    PHP:
      $this->registredEntities[$bossEntity->getId()] = $bossEntity;
    Can I do like this
    PHP:
      $this->registredEntities($thisZeus);
     
  5. Ayush

    Ayush Witch

    Messages:
    62
    PLSS try fast I can't wait
     
  6. Ayush

    Ayush Witch

    Messages:
    62
  7. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Register the entity like how PMMP does...???
     
    Ayush likes this.
  8. Ayush

    Ayush Witch

    Messages:
    62
    I don't know how to do pls give example so I m able plss
     
  9. Primus

    Primus Zombie Pigman

    Messages:
    749
    Why would you lie about "making" this plugin when you clearly have no idea what you're doing? It's totally fine to ask for help, you don't have to lie about anything.
     
    DavyCraft648, Ayush and minijaham like this.
  10. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Primus likes this.
  11. Ayush

    Ayush Witch

    Messages:
    62
    I am making by looking another plugins so I came here for help and thank u all
     
    Primus likes this.
  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.