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

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 Silverfish

    Messages:
    21
    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 Skeleton

    Messages:
    801
    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 Skeleton

    Messages:
    801
    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.
     
  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.