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

Cancel placing item in item frame

Discussion in 'General discussion' started by xXNiceAssassinlo YT, Mar 31, 2018.

  1. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    How do I cancel placing item inside item frame
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Cancel PlayerInteractEvent when PlayerInteractEvent::getBlock() is Item Frame.
     
  3. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    Can I get a example please?
     
  4. LewBr

    LewBr Zombie

    Messages:
    385
    GitHub:
    lewbr
    PHP:
        public function(PlayerInteractEvent $event){
            
    $block $event->getBlock();
            
    //389 id is the item frame
            
    if($block->getId() == 389){
                
    $event->setCancelled();
            }
        }

     
  5. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    I accidentally post this thread to general can anyone move it to development
     
  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.