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

[SELF-SOLVED] Disallow Item Frame Griefing

Discussion in 'Development' started by Muqsit, Feb 10, 2017.

  1. GilBenDavid

    GilBenDavid Silverfish

    Messages:
    20
    i dont know how to ask quistion here so i ask it here sorry about this
    and sorry about my english
    the problem is that the block isnt return (when i join without myname)
    PHP:
    public function onBreak(BlockBreakEvent $event) {
        
    $block $event->getBlock();
        
    $level $block->getLevel();
        
    $player $event->getPlayer()->getName();
        if (
    $player === "myname") {
    }elseif(
    $level->getName() === "world") {
            
    $event->setCancelled();
    }
    }
     
  2. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    Yes, it sometimes the code runs not fast enough and the player can still get out the Item out.
     
  3. GilBenDavid

    GilBenDavid Silverfish

    Messages:
    20
    thank you
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    So the best way to handle it is by using DataPacketEvent.
     
  5. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    Use
    Code:
    $player->setGamemode($player::ADVENTURE);
    :D
     
  6. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    And if you want players to be able to break blocks?
     
    Muqsit likes this.
  7. GilBenDavid

    GilBenDavid Silverfish

    Messages:
    20
    I tracked down the problem it was someting in another plugin
    thanks !
     
  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.