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

How can I cancel drop ?

Discussion in 'General discussion' started by MusicNOvas, Apr 20, 2019.

  1. MusicNOvas

    MusicNOvas Spider Jockey

    Messages:
    43
    PHP:
    public function onBreak(BBL $e){
            if(
    $e->getBlock()->getId() == 244);
            
    $e->isCancelDrop(true);
        }
     
  2. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    Stop writing that shitty code please
    PHP:
    public function onBreak(BlockBreakEvent $event) {
        if(
    $event->getBlock()->getId() === Block::BEETROOT_BLOCK) {
            
    $event->setDrops([]);
        }
    }
     
    MusicNOvas likes this.
  3. MusicNOvas

    MusicNOvas Spider Jockey

    Messages:
    43
    Thanks!! And sorry for this "shitty code"
     
  4. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    Sorry tbh, I just don't like the fact that you use BBL $e and many other things because it's not clean at all
     
  5. MusicNOvas

    MusicNOvas Spider Jockey

    Messages:
    43
    Lol ! I use
    PHP:
    use pocketmine\event\block\BlockBreakEvent as BBL;
    It's more simple ^_^
     
  6. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    because it's not clean at all
     
  7. MusicNOvas

    MusicNOvas Spider Jockey

    Messages:
    43
    Gnegne. I do what I want
    Clean or not it works.
     
  8. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    Yeah do whatever you want your code style seems to be good
     
  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.