Setting a region

Discussion in 'Plugin Development' started by Snowl, Jan 24, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Snowl

    So i have this:
    Code:
                        if(event.getPlayer().getLocation().getX() >= locx && event.getPlayer().getLocation().getX() <= locx1 && event.getPlayer().getLocation().getY() >= locy && event.getPlayer().getLocation().getY() <= locy1 && event.getPlayer().getLocation().getZ() >= locz && event.getPlayer().getLocation().getZ() <= locz1 )
    But when I try and run my code and get out of the region it still triggers, why :(
     
  2. Offline

    Fifteen

    I don't get what you're trying to do. When and how does this code trigger?
     
  3. Offline

    Zand

    Your if statement looks good. Try adding a line before the if statement.
    Code:
    System.out.println("debug: "
        + locx + "-" + locx1 + ", "
        + locy + "-" + locy1 + ", "
        + locz + "-" + locz1);
    
    if( event.getPlayer().getLocation().getX() >= locx &&
        event.getPlayer().getLocation().getX() <= locx1 &&
        event.getPlayer().getLocation().getY() >= locy &&
        event.getPlayer().getLocation().getY() <= locy1 &&
        event.getPlayer().getLocation().getZ() >= locz &&
        event.getPlayer().getLocation().getZ() <= locz1 )
     
  4. Offline

    Snowl

    when I call a command, if the player is inside a specified region it should allow it, otherwise it will say "You are not allowed to use that here"
    --- merged: Jan 24, 2011 9:42 PM ---
    Heres what it spit out (with an extra get player location
    debug: 2-50, 15-100, 16-36-Location{world=CraftWorldx=54.48166639522478y=70.0z=36.2788494138605pitch=44.54996yaw=316.19986}
     
Thread Status:
Not open for further replies.

Share This Page