Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.     public void protectBiome(Location loc) {
  2.         Biome biome = loc.getBlock().getBiome();
  3.         this.queue.add(biome);
  4.  
  5.         while (this.queue.contains(biome))
  6.         {
  7.             this.rad++;
  8.            
  9.             // Empty queue
  10.             for (ListIterator<Biome> it = queue.listIterator(queue.size());it.hasPrevious(); )
  11.             {
  12.                 Biome b = it.previous();
  13.                 queue.remove(b);
  14.             }
  15.            
  16.             // Section A
  17.             for (double len = (rad * -1); len == rad; len++)
  18.             {
  19.                 this.check = new Location(loc.getWorld(),loc.getX() + rad,loc.getY(),loc.getZ() + len);
  20.                 queue.add(check.getBlock().getBiome());
  21.                 if (check.getBlock().getBiome() == biome)
  22.                 {
  23.                     this.area.add(check);
  24.                 }
  25.             }
  26.             // Section B
  27.             for (double len = rad; len == (rad * -1); len--)
  28.             {
  29.                 this.check = new Location(loc.getWorld(),loc.getX() + len,loc.getY(),loc.getZ() + rad);
  30.                 queue.add(check.getBlock().getBiome());
  31.                 if (check.getBlock().getBiome() == biome)
  32.                 {
  33.                     this.area.add(check);
  34.                 }
  35.             }
  36.             // Section C
  37.             for (double len = rad; len == (rad * -1); len--)
  38.             {
  39.                 this.check = new Location(loc.getWorld(),loc.getX() - rad,loc.getY(),loc.getZ() + len);
  40.                 queue.add(check.getBlock().getBiome());
  41.                 if (check.getBlock().getBiome() == biome)
  42.                 {
  43.                     this.area.add(check);
  44.                 }
  45.             }
  46.             // Section D
  47.             for (double len = (rad * -1); len == rad; len++)
  48.             {
  49.                 this.check = new Location(loc.getWorld(),loc.getX() + len,loc.getY(),loc.getZ() - rad);
  50.                 queue.add(check.getBlock().getBiome());
  51.                 if (check.getBlock().getBiome() == biome)
  52.                 {
  53.                     this.area.add(check);
  54.                 }
  55.             }
  56.         }
  57.        
  58.         // For Testing Purposes
  59.         for (Location locat: area)
  60.         {
  61.             locat.getBlock().setType(Material.DIAMOND_BLOCK);
  62.         }
  63.     }