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

I have a problem with EntityDamageByEntity event

Comments in 'Plugin Development' started by BlubberBoy333, Apr 6, 2016.

  1. BlubberBoy333
    Offline

    BlubberBoy333 Active Member

    Joined:
    Aug 31, 2014
    Posts:
    177
    Minecraft User:
    Blubberboy333
    So I'm making a plugin that disables PvP in certain worlds. But when i start my server it says:

    "pocketmine\utils\PluginException: "pocketmine\event\entity\EntityDamageByEntityEvent does not have a handler list" (EXCEPTION) in "/src/pocketmine/plugin/PluginManager"at line 750"

    Does anyone know why it is doing this?
  2. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    Can you show us the code?
    applqpak likes this.
  3. KaitoDoDo
    Offline

    KaitoDoDo New Member

    Joined:
    Feb 10, 2016
    Posts:
    17
    Minecraft User:
    KaitoDoDoYT
    Maybe this:
    public function onEntityDamage(EntityDamageEvent $event){
    if ($event instanceof EntityDamageByEntityEvent) {
    if ($event->getEntity() instanceof Player && $event->getDamager() instanceof Player) {
    $atacker = $event->getDamager();
    $level = $atacker->getLevel();
    if($level=="MAP-NO-PVP")
    {
    $event->setCancelled();
    }
    }
    }
    }

    Add:
    $this->getServer()->getPluginManager()->registerEvents($this ,$this); on Enable function

    and of course you need use EntityDamageEvent
  4. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    You cannot use EntityDamageByEntityEvent directly. Use EntityDamageEvent and check if $event is instanceof EntityDamageByEntityEvent. (While $event ie your event, of course)

Share This Page

Advertisement