Solved Chack if the player is within a certain area

Discussion in 'Plugin Development' started by ramptoetsenbord, Aug 1, 2017.

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

    ramptoetsenbord

    I want to make a survival Server with a spawn.
    I want that wen you break a block in the spawn, it will cancel the event,
    but I don 't know how to check if the player is within a certian area.

    my spawn is x: 10, z: 10 to x: -10 and z: -10

    if (someoneCouldHelp == true) {
    player.sendMessage("that would be cool!")
    }
     
  2. Offline

    MrGriefer_

    Listen for BlockBreakEvent check if player is within the spawn location, for example:
    PHP:
    if (Math.abs(playerx certainlocationx) <= && playery certainlocationy) <= && playerz certainlocationz) <= 3) {
        
    // Player is within a 3 block cube of location.
    } else {
        
    // Player is not within a 3 block cube of location.
    }
    If player is within the location cancel the event if not just return.
     
  3. Offline

    Zombie_Striker

  4. Offline

    ramptoetsenbord

    Thank you! it is solved! :p
     
Thread Status:
Not open for further replies.

Share This Page