Check if players are in area?

Discussion in 'Plugin Development' started by SynteX, Aug 5, 2014.

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

    SynteX

    Hello,

    I am trying to create a kind of bow spleef but i've got a problem.
    I want to know how many people are on the field and i want to give stuff to the people on my field.
    I've made a field generator of tnt so you can walk on tnt like:

    Code:java
    1. public void makeArena() {
    2. Location start = new Location(Bukkit.getWorld("pretpark"), 1547, 4, 604);
    3. Location end = new Location(Bukkit.getWorld("pretpark"), 1527, 4, 570);
    4.  
    5. int aX = Math.max(start.getBlockX(), end.getBlockX());
    6. int bX = Math.min(start.getBlockX(), end.getBlockX());
    7.  
    8. int aZ = Math.max(start.getBlockZ(), end.getBlockZ());
    9. int bZ = Math.min(start.getBlockZ(), end.getBlockZ());
    10.  
    11. for(int x = bX; x <= aX; x++) {
    12. for(int z = bZ; z <= aZ; z++) {
    13. Block block = start.getWorld().getBlockAt(x, start.getBlockY(), z);
    14. block.setType(Material.TNT);
    15. }
    16. }
    17. }


    But how can i check how many players are on the field and how can i give them stuff???
     
  2. Offline

    moe097

    SynteX
    For checking if there in that location try using "getLocation().equals(YourLocationNameHere)"
     
Thread Status:
Not open for further replies.

Share This Page