Solved Most Efficient Way To Check if 5 blocks around is placed spawner.

Discussion in 'Plugin Development' started by Ibas, Aug 14, 2013.

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

    Ibas

    I want to limit that only one spawner would be possible to place every 5 blocks from the first one. Code (I know it's only with Y, but when I will know how to make code with Y there will be easy with X,Z):

    Code:java
    1. @EventHandler
    2. public void spawnerPlace(BlockPlaceEvent e){
    3.  
    4. if(e.getBlockPlaced().getType() == Material.MOB_SPAWNER){
    5. final Block block = e.getBlockPlaced();
    6. for (int y = block.getY()-5; y == block.getY()+5; y ++) {
    7. if(block.getRelative(-140, y, -205).getType() ==Material.MOB_SPAWNER) {
    8. System.out.println("I found a mob spawner nearby...");
    9. }
    10. }
    11. }
    12.  
    13. }
     
  2. Offline

    Necrodoom

    locked per OP request.
     
Thread Status:
Not open for further replies.

Share This Page