How to fix TNT in-game Bedwars, i set it cancelled for placing block things

Discussion in 'General discussion' started by Hoangviphb999, Nov 21, 2020.

  1. Hoangviphb999

    Hoangviphb999 Creeper

    Messages:
    4
    GitHub:
    Hoangviphb999
    if($event->getBlock()->getId() == Block::TNT){
    $event->getBlock()->ignite();
    }

    if($event->getBlock()->getId() == Block::TNT){
    $event->setCancelled();


    TNT is still normal working. But the block in hand count is not decrease when i placed it.
     
  2. minijaham

    minijaham Baby Zombie

    Messages:
    176
    GitHub:
    minijaham
    Show us the full code. What event did you exactly use? Block place event?
     
  3. BeastBomber23

    BeastBomber23 Silverfish

    Messages:
    24
    GitHub:
    beastbomber23
    get rid of $event->setCancelled();
     
    minijaham and Primus like this.
  4. minijaham

    minijaham Baby Zombie

    Messages:
    176
    GitHub:
    minijaham
    You still could keep $event->setCancelled() and use
    PHP:
    $item Item::get(4601); // TNT (amount: 1)
    $player->getInventor()->removeItem($item);
    But the previous method would be the best.
     

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.