Location and 50 Blocks in all Direction (Circle)

Discussion in 'Plugin Development' started by JeykoExample, Sep 18, 2014.

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


    Hey Guys :) ,
    i have made a Plugin and i want to like check if a player is in a region, like the SpawnLocation and 100 Blocks in all Directions like a Circle and i wanted to ask you guys, if you can help me.

    Thanks a LOT!
  2. Offline


    If you have your Spawn-Location, you can get the location of any entity, call .distanceSquared(yourSpawnLocation) and compare that to your radius powered by 2. Here's an example for players:
    2. double distance = p.getLocation().distanceSquared(yourSpawnLocation);
    3. int radius = 100; //You can change this
    4. if (distance <= radius * radius) {
    5. p.sendMessage("You're inside the circle-spawn area");
    6. }
Thread Status:
Not open for further replies.

Share This Page