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

How to open chest while spawn protection is enabled

Discussion in 'Plugin Help' started by Destroyer57, Jul 26, 2018.

  1. Destroyer57

    Destroyer57 Zombie

    Messages:
    275
    The title says it
     
  2. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    PHP:
    public function onInteract(PlayerInteractEvent $event) : void{
        if(
    $event->getBlock()->getId() === 54 && $event->isCancelled()) $event->setCancelled(false);
    }
     
  3. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    That could conflict with other plugins, so you might want to check the priority of your event handler.
     
    Awzaw likes this.
  4. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    And you shouldn't use hard-coded block IDs.
     
  5. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    Maybe checking if the block xz minus the world's spawn xz equals <= 16 or >= -16
     
  6. Destroyer57

    Destroyer57 Zombie

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