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

Event Not Canceling

Discussion in 'Development' started by Junkdude, Jan 7, 2017.

  1. xZeroMCPE

    xZeroMCPE Witch

    Messages:
    67
    GitHub:
    xZeroMCPE
    What position was the XZ taken?

    We can always use your XZ's to create a cuboid region like the code i provided above, but well structured.
     
    applqpak likes this.
  2. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
    i made it in like a 4x5 region
     
  3. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    PHP:
    public function onBreak(BlockBreakEvent $event){
        
    $p $event->getPlayer();
        
    //$cfg = new Config($this->getDataFolder() . "xyz.yml", Config::YAML);
        
    $x $p->getX();
        
    $y $p->getY();
        
    $z $p->getZ();
        
    $xx = [214210];
        
    $yy = [7469];
        
    $zz = [14];
        if(
    $x >= min($xx) and $x <= max($xx) and $y >= min($yy) and $y <= max($yy) and $z >= min($zz) and $z <= max($zz)){
            
    $p->sendmessage("In Region");
        }else{
            
    $p->sendmessage("Not In Region");
        }
    }
     
    Last edited: Jan 9, 2017
    applqpak and Primus like this.
  5. Primus

    Primus Zombie Pigman

    Messages:
    749
    Can't hold back to point that 'break' can't be function name, sorry I know that this is just an example :p
     
    applqpak and Muqsit like this.
  6. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Oh I didn't notice that while quoting...wow
     
    applqpak and InspectorGadget like this.
  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.