Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved No handlers list?

Comments in 'Plugin Development' started by HotFireyDeath, Nov 28, 2015.

  1. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    I'm getting this error when using EntityDamageByEntityEvent() :
    Code:
    [Server thread/CRITICAL]: pocketmine\utils\PluginException: "pocketmine\event\entity\EntityDamageByEntityEvent does not have a handler list" (EXCEPTION) in "/src/pocketmine/plugin/PluginManager" at line 759
    If anyone can help, I'd be glad. Thanks :)
  2. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    EntityDamageByEntityEvent cannot be used as an event handler.
    HotFireyDeath likes this.
  3. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    Oh. Ok, thanks :)
  4. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    The correct way would be:
    PHP:
    public function onDamage(EntityDamageEvent $event) {
        
    $entity $event->getEntity();
        
    $cause $entity->getLastDamageCause();

       if(
    $cause instanceof EntityDamageByEntityEvent) {
           
    // code
         
    }
      }
    Manato and HotFireyDeath like this.
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Why getLastDamageCause()? We are looking at the current cause, not the last cause.
    Legoboy0215 likes this.

Share This Page

Advertisement