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

Check if player is hitting npc or slapper

Discussion in 'Development' started by WhoAreMe, May 26, 2020.

  1. WhoAreMe

    WhoAreMe Witch

    Messages:
    55
    Is it possible to check if player is hitting an pc or slapper? I want to prevent player from using command. I know i can just set permission and delete that later. But that is just too much hassle. Also, i dont wanna see my console setting and unsetting permission.
     
  2. WhoAreMe

    WhoAreMe Witch

    Messages:
    55
    Is is possible?
     
  3. Khaled

    Khaled Slime

    Messages:
    81
    GitHub:
    xXKHaLeD098Xx
    use EntityDamageEvent (pmmp) or SlapperHitEvent (slapper) to check if the player is hitting a slapper npc
     
    WhoAreMe likes this.
  4. Emirhan Akpınar

    Emirhan Akpınar Slime

    Messages:
    90
    or he can use EntityDamageByEntityEvent for get / check damager (Player) & entity (SlapperHuman)
     
  5. WhoAreMe

    WhoAreMe Witch

    Messages:
    55
    I tried doing that and already checked it using EntityDamageByEntityEvent but got stucked implementing slapper. I don't know to get class from another plugin.
     
  6. WhoAreMe

    WhoAreMe Witch

    Messages:
    55
    Say i do this api = $this->getServer()->getPluginManager()->getPluginManager()->getPlugin("Slapper");
    Can i call it just like this?
    $this->getServer()->getPluginManager()->callEvent($event = new SlapperHitEvent($entity, $damager));
     
  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.