Help Me

Discussion in 'Plugin Help' started by kombanwa, Jul 29, 2020.

  1. kombanwa

    kombanwa Spider

    Messages:
    8
    Hello. Everyone
    I want to create Remove Arrow Plugin.
    If arrow hit the block Remove it.

    PHP:
    <?php

    namespace RA;

    use 
    pocketmine\Player;
    use 
    pocketmine\entity\Entity;
    use 
    pocketmine\entity\Arrow;
    use 
    pocketmine\event\entity\ProjectileHitBlockEvent;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Server;

    class 
    RemoveArrow extends PluginBase {

    public function 
    hitblock(ProjectileHitBlockEvent $ev){
            if(
    $ev->getEntity() instanceof Arrow){
                
    $ev->getEntity()->close();
             }
            }
    }
    It isn't work
     
  2. GodWeedZao

    GodWeedZao Zombie

    Messages:
    205
    GitHub:
    godweedzao
    Any error?
     
  3. GodWeedZao

    GodWeedZao Zombie

    Messages:
    205
    GitHub:
    godweedzao
    Try debug it.
     
  4. kombanwa

    kombanwa Spider

    Messages:
    8
    Not error and not work lol
     
  5. Primus

    Primus Zombie

    Messages:
    399
    Have you registered the listener?
    PHP:
    class RemoveArrow extends PluginBase implements \pocketmine\event\Listener {
    And
    PHP:
    public function onEnable() {
        
    $this->getServer()->getPluginManager()->registerListeners($this$this);
    }
     

Share This Page

  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.