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

"Cannot send empty batch"

Discussion in 'Development' started by xXNiceAssassinlo YT, Jun 16, 2018.

  1. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    error:
    PHP:
    [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'ExonCore v1.0.0'Cannot send empty batch on ExonCore\crate\EventListener
    [13:42:02] [Server thread/CRITICAL]: InvalidArgumentException"Cannot send empty batch" (EXCEPTIONin "src/pocketmine/Server" at line 1852
    code:
    PHP:
        public function remove(array $players null): void{
            
    $this->particle->setInvisible();
            if(
    $players == null){
                
    $players Core::get()->getServer()->getOnlinePlayers();
            }
            foreach(
    $players as $playerCore::get()->getServer()->getDefaultLevel()->addParticle($this->particle, [$player]);
        }
    Interact:
    PHP:
        public function onInteract(PlayerInteractEvent $e): void{
            
    #$this->text = new FloatingTextPM(new Vector3(274, 136, 70), "", "");
            
    $player $e->getPlayer();
            
    $block $e->getBlock();
            
    $x $block->getX();
            
    $y $block->getY();
            
    $z $block->getZ();
            
    $manager = new FloatingTextManager();

            if(
    $player instanceof ExonPlayer){
                if(
    $block->getId() == Block::CHEST){
                    if(
    $x == 274 && $y 135 && $z 70){
                        
    $e->setCancelled();
                        if(!
    $player->getCfg($player)->get("vote") >= 1){
                            
    $player->sendMessage(C::RED "You don't have vote key.");
                            
    #$this->text->setText("1");
                            #$player->getLevel()->addParticle($this->text);
                            
    $manager->setName("hi");
                            
    $manager->add([$player], true);
                            return;
                        }else{
                            
    $manager->remove([$player]);
                            return;
                        }
                       
                    }
                }
            }
        }
     
  2. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Why you repeat addParticle() with one player per array?
     
  3. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    To delete/add particle
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    PHP:
    Core::get()->getServer()->getDefaultLevel()->addParticle($this->particle, [$player]);
    Replace [$player] with $players.
     
  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.