Check spawn protection?

Discussion in 'Plugin Development' started by Techy4198, Aug 21, 2014.

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

    Techy4198

    How do I check if a block is in Bukkit's built-in spawn protection and whether a player can build in it? Can't seem to find anything.
     
  2. Offline

    DevSock

  3. Offline

    Cycryl

    Techy4198
    dont think you can but you can turn it off and use your own:
    Code:java
    1. @EventHandler
    2. public void onInteract(PlayerInteractEvent event){
    3. Location loc = event.getClickedBlock().getLocation();
    4. if(loc.toVector().subtract(loc.getWorld().getSpawnLocation().toVector()).length()<=100){
    5. System.out.println("Player tried to mine block within spawn protection");
    6. }
    7. }


    this will check if a Player interacts with a block within a 100 block radius of spawn
     
  4. Cycryl Techy4198 you can get the spawn protection distance from the config, cant you? then you dont need to use your own one, you can use the value the server is using, too
     
  5. Offline

    ChipDev

    Isn't there getServer().getSpawnRadius()..?
    Well, Yes.
     
  6. Offline

    Cycryl

    oh wow nice :3
     
  7. Offline

    Techy4198

    Is it a square area or a circular one? I assume square. Also what defines whether or not the player can build in the spawn protection? is it just if they're op? Another thing, with multiple worlds, does it apply to every world or just the default world?
     
Thread Status:
Not open for further replies.

Share This Page