Program: 33812
Project: 33812
Buggy source:
public DeleteIslandChunk(final ASkyBlock plugin,final Island island){
  final World world=island.getCenter().getWorld();
  if (world == null)   return;
  boolean cleanUpBlocks=false;
  if (Settings.islandDistance - island.getProtectionSize() < 16) {
    cleanUpBlocks=true;
  }
  int range=island.getProtectionSize() / 2 * +1;
  final int minx=island.getMinProtectedX();
  final int minz=island.getMinProtectedZ();
  final int maxx=island.getMinProtectedX() + island.getProtectionSize();
  final int maxz=island.getMinProtectedZ() + island.getProtectionSize();
  int islandSpacing=Settings.islandDistance - island.getProtectionSize();
  int minxX=(island.getCenter().getBlockX() - range - islandSpacing);
  int minzZ=(island.getCenter().getBlockZ() - range - islandSpacing);
  int maxxX=(island.getCenter().getBlockX() + range + islandSpacing);
  int maxzZ=(island.getCenter().getBlockZ() + range + islandSpacing);
  final Chunk minChunk=world.getBlockAt(minx,0,minz).getChunk();
  final Chunk maxChunk=world.getBlockAt(maxx,0,maxz).getChunk();
  for (int x=minChunk.getX(); x <= maxChunk.getX(); x++) {
    for (int z=minChunk.getZ(); z <= maxChunk.getZ(); z++) {
      boolean regen=true;
      if (world.getChunkAt(x,z).getBlock(0,0,0).getX() < minxX) {
        regen=false;
      }
      if (world.getChunkAt(x,z).getBlock(0,0,0).getZ() < minzZ) {
        regen=false;
      }
      if (world.getChunkAt(x,z).getBlock(15,0,15).getX() > maxxX) {
        regen=false;
      }
      if (world.getChunkAt(x,z).getBlock(15,0,15).getZ() > maxzZ) {
        regen=false;
      }
      if (regen) {
        world.regenerateChunk(x,z);
        if (Settings.newNether && Settings.createNether) {
          if (world.equals(ASkyBlock.getIslandWorld())) {
            ASkyBlock.getNetherWorld().regenerateChunk(x,z);
          }
          if (world.equals(ASkyBlock.getNetherWorld())) {
            ASkyBlock.getIslandWorld().regenerateChunk(x,z);
          }
        }
      }
 else {
        if (cleanUpBlocks) {
          chunksToClear.add(new Pair<Integer,Integer>(x,z));
        }
      }
    }
  }
  plugin.getGrid().deleteIsland(island.getCenter());
  if (!chunksToClear.isEmpty()) {
    try {
      nms=Util.checkVersion();
    }
 catch (    Exception ex) {
      plugin.getLogger().warning("String_Node_Str");
      return;
    }
    plugin.getLogger().info("String_Node_Str" + chunksToClear.size() + "String_Node_Str");
    plugin.getLogger().info("String_Node_Str" + Settings.cleanRate + "String_Node_Str"+ Math.round(chunksToClear.size() / Settings.cleanRate)+ "String_Node_Str");
    new BukkitRunnable(){
      @SuppressWarnings("String_Node_Str") @Override public void run(){
        Iterator<Pair<Integer,Integer>> it=chunksToClear.iterator();
        int count=0;
        while (it.hasNext() && count++ < Settings.cleanRate) {
          Pair<Integer,Integer> pair=it.next();
          for (int x=0; x < 16; x++) {
            for (int z=0; z < 16; z++) {
              int xCoord=pair.x * 16 + x;
              int zCoord=pair.z * 16 + z;
              if (island.inIslandSpace(xCoord,zCoord)) {
                for (int y=0; y < ASkyBlock.getIslandWorld().getMaxHeight(); y++) {
                  Block b=ASkyBlock.getIslandWorld().getBlockAt(xCoord,y,zCoord);
                  Material bt=b.getType();
                  Material setTo=Material.AIR;
                  if (y < Settings.seaHeight) {
                    setTo=Material.STATIONARY_WATER;
                  }
switch (bt) {
case CHEST:
case TRAPPED_CHEST:
case FURNACE:
case DISPENSER:
case HOPPER:
                    final InventoryHolder ih=((InventoryHolder)b.getState());
                  ih.getInventory().clear();
                b.setType(setTo);
              break;
case AIR:
            if (setTo.equals(Material.STATIONARY_WATER)) {
              nms.setBlockSuperFast(b,setTo.getId(),(byte)0,false);
            }
case STATIONARY_WATER:
          if (setTo.equals(Material.AIR)) {
            nms.setBlockSuperFast(b,setTo.getId(),(byte)0,false);
          }
default :
        nms.setBlockSuperFast(b,setTo.getId(),(byte)0,false);
      break;
  }
  if (Settings.newNether && Settings.createNether && y < ASkyBlock.getNetherWorld().getMaxHeight() - 8) {
    b=ASkyBlock.getNetherWorld().getBlockAt(xCoord,y,zCoord);
    bt=b.getType();
    if (!b.equals(Material.AIR)) {
      setTo=Material.AIR;
switch (bt) {
case CHEST:
case TRAPPED_CHEST:
case FURNACE:
case DISPENSER:
case HOPPER:
        final InventoryHolder ih=((InventoryHolder)b.getState());
      ih.getInventory().clear();
    b.setType(setTo);
  break;
default :
nms.setBlockSuperFast(b,setTo.getId(),(byte)0,false);
break;
}
}
}
}
}
}
}
it.remove();
}
if (chunksToClear.isEmpty()) {
plugin.getLogger().info("String_Node_Str");
this.cancel();
}
}
}
.runTaskTimer(plugin,0L,20L);
}
}

Fixed version (ground truth):
public DeleteIslandChunk(final ASkyBlock plugin,final Island island){
  final World world=island.getCenter().getWorld();
  if (world == null)   return;
  boolean cleanUpBlocks=false;
  if (Settings.islandDistance - island.getProtectionSize() < 16) {
    cleanUpBlocks=true;
  }
  int range=island.getProtectionSize() / 2 * +1;
  final int minx=island.getMinProtectedX();
  final int minz=island.getMinProtectedZ();
  final int maxx=island.getMinProtectedX() + island.getProtectionSize();
  final int maxz=island.getMinProtectedZ() + island.getProtectionSize();
  int islandSpacing=Settings.islandDistance - island.getProtectionSize();
  int minxX=(island.getCenter().getBlockX() - range - islandSpacing);
  int minzZ=(island.getCenter().getBlockZ() - range - islandSpacing);
  int maxxX=(island.getCenter().getBlockX() + range + islandSpacing);
  int maxzZ=(island.getCenter().getBlockZ() + range + islandSpacing);
  final Chunk minChunk=world.getBlockAt(minx,0,minz).getChunk();
  final Chunk maxChunk=world.getBlockAt(maxx,0,maxz).getChunk();
  for (int x=minChunk.getX(); x <= maxChunk.getX(); x++) {
    for (int z=minChunk.getZ(); z <= maxChunk.getZ(); z++) {
      boolean regen=true;
      if (world.getChunkAt(x,z).getBlock(0,0,0).getX() < minxX) {
        regen=false;
      }
      if (world.getChunkAt(x,z).getBlock(0,0,0).getZ() < minzZ) {
        regen=false;
      }
      if (world.getChunkAt(x,z).getBlock(15,0,15).getX() > maxxX) {
        regen=false;
      }
      if (world.getChunkAt(x,z).getBlock(15,0,15).getZ() > maxzZ) {
        regen=false;
      }
      if (regen) {
        world.regenerateChunk(x,z);
        if (Settings.newNether && Settings.createNether) {
          if (world.equals(ASkyBlock.getIslandWorld())) {
            ASkyBlock.getNetherWorld().regenerateChunk(x,z);
          }
          if (world.equals(ASkyBlock.getNetherWorld())) {
            ASkyBlock.getIslandWorld().regenerateChunk(x,z);
          }
        }
      }
 else {
        if (cleanUpBlocks) {
          chunksToClear.add(new Pair<Integer,Integer>(x,z));
        }
      }
    }
  }
  plugin.getGrid().deleteIsland(island.getCenter());
  if (!chunksToClear.isEmpty()) {
    try {
      nms=Util.checkVersion();
    }
 catch (    Exception ex) {
      plugin.getLogger().warning("String_Node_Str");
      return;
    }
    plugin.getLogger().info("String_Node_Str" + chunksToClear.size() + "String_Node_Str");
    plugin.getLogger().info("String_Node_Str" + Settings.cleanRate + "String_Node_Str"+ Math.round((float)chunksToClear.size() / Settings.cleanRate)+ "String_Node_Str");
    new BukkitRunnable(){
      @SuppressWarnings("String_Node_Str") @Override public void run(){
        Iterator<Pair<Integer,Integer>> it=chunksToClear.iterator();
        int count=0;
        while (it.hasNext() && count++ < Settings.cleanRate) {
          Pair<Integer,Integer> pair=it.next();
          for (int x=0; x < 16; x++) {
            for (int z=0; z < 16; z++) {
              int xCoord=pair.x * 16 + x;
              int zCoord=pair.z * 16 + z;
              if (island.inIslandSpace(xCoord,zCoord)) {
                for (int y=0; y < ASkyBlock.getIslandWorld().getMaxHeight(); y++) {
                  Block block=ASkyBlock.getIslandWorld().getBlockAt(xCoord,y,zCoord);
                  Material blockType=block.getType();
                  Material setTo=Material.AIR;
                  if (y < Settings.seaHeight) {
                    setTo=Material.STATIONARY_WATER;
                  }
switch (blockType) {
case CHEST:
case TRAPPED_CHEST:
case FURNACE:
case DISPENSER:
case HOPPER:
                    final InventoryHolder ih=((InventoryHolder)block.getState());
                  ih.getInventory().clear();
                block.setType(setTo);
              break;
case AIR:
            if (setTo.equals(Material.STATIONARY_WATER)) {
              nms.setBlockSuperFast(block,setTo.getId(),(byte)0,false);
            }
case STATIONARY_WATER:
          if (setTo.equals(Material.AIR)) {
            nms.setBlockSuperFast(block,setTo.getId(),(byte)0,false);
          }
default :
        nms.setBlockSuperFast(block,setTo.getId(),(byte)0,false);
      break;
  }
  if (Settings.newNether && Settings.createNether && y < ASkyBlock.getNetherWorld().getMaxHeight() - 8) {
    block=ASkyBlock.getNetherWorld().getBlockAt(xCoord,y,zCoord);
    blockType=block.getType();
    if (!blockType.equals(Material.AIR)) {
      setTo=Material.AIR;
switch (blockType) {
case CHEST:
case TRAPPED_CHEST:
case FURNACE:
case DISPENSER:
case HOPPER:
        final InventoryHolder ih=((InventoryHolder)block.getState());
      ih.getInventory().clear();
    block.setType(setTo);
  break;
default :
nms.setBlockSuperFast(block,setTo.getId(),(byte)0,false);
break;
}
}
}
}
}
}
}
it.remove();
}
if (chunksToClear.isEmpty()) {
plugin.getLogger().info("String_Node_Str");
this.cancel();
}
}
}
.runTaskTimer(plugin,0L,20L);
}
}