BlockBreakEvent does not get called when breaking a block

Discussion in 'Plugin Help' started by BloxxDev, Dec 17, 2020.

  1. BloxxDev

    BloxxDev Creeper

    Messages:
    1
    PHP:
    function onTree(BlockBreakEvent $e){
            
    $this->getLogger()->info("TEST");
            
    $this->getLogger()->info($e->getBlock()->getName());
            if(
    $e->getBlock()->getName()=="log"){
                
    $this->getLogger()->info("TEST");
            }
        }
    So if I break a block TEST should be sent to the console instead I get nothing: no error, no output, nothing

    pls help
     
  2. mmm545

    mmm545 Baby Zombie

    Messages:
    123
    GitHub:
    mmm545
    did you register the event?
     
  3. Marie meow

    Marie meow Spider

    Messages:
    13
    PHP:
     function onTree(BlockBreakEvent $e){
            
    $this->getLogger()->info("TEST");
            
    $this->getLogger()->info($e->getBlock()->getName());
            if(
    $e->getBlock()->getName() === "log"){ //===
                
    $this->getLogger()->info("TEST");
            }
        }
     
  4. mmm545

    mmm545 Baby Zombie

    Messages:
    123
    GitHub:
    mmm545
    No not that, I'm talking about this
    PHP:
    $this->getServer()->getPluginManager()->registerEvents($this$this);
    Did you put that line in your onEnable function?
     

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.