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

iProtector plugin

Discussion in 'Help' started by Martti16, Apr 16, 2017.

  1. Martti16

    Martti16 Spider

    Messages:
    14
    GitHub:
    Marttinek
    How to add stone block destruction to an area? Plugin: iProtector by LDX


    public function onBlockBreak(BlockBreakEvent $event) {
    $b = $event->getBlock();
    $p = $event->getPlayer();
    $n = strtolower($p->getName());
    if(isset($this->sel1[$n])) {
    unset($this->sel1[$n]);
    $this->pos1[$n] = new Vector3($b->getX(),$b->getY(),$b->getZ());
    $p->sendMessage("Position 1 set to: (" . $this->pos1[$n]->getX() . ", " . $this->pos1[$n]->getY() . ", " . $this->pos1[$n]->getZ() . ")");
    $event->setCancelled();
    } else if(isset($this->sel2[$n])) {
    unset($this->sel2[$n]);
    $this->pos2[$n] = new Vector3($b->getX(),$b->getY(),$b->getZ());
    $p->sendMessage("Position 2 set to: (" . $this->pos2[$n]->getX() . ", " . $this->pos2[$n]->getY() . ", " . $this->pos2[$n]->getZ() . ")");
    $event->setCancelled();
    } else {
    if(!$this->canEdit($p,$b)) {
    $event->setCancelled();
    }
    }
    }
     
  2. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    USE CODE BLOCKS!!
    also, I believe this is in the wrong section
     
  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.