Program: 33998
Project: 33998
Buggy source:
/** 
 * Calculates the level of an island
 * @param plugin
 * @param targetPlayer
 * @param asker
 */
public LevelCalcByChunk(final ASkyBlock plugin,final UUID targetPlayer,final Player asker,final boolean silent){
  final Island island=plugin.getGrid().getIsland(targetPlayer);
  if (island != null) {
    World world=plugin.getPlayers().getIslandLocation(targetPlayer).getWorld();
    Set<ChunkSnapshot> chunkSnapshot=new HashSet<ChunkSnapshot>();
    for (int x=island.getMinProtectedX(); x < (island.getMinProtectedX() + island.getProtectionSize() + 16); x+=16) {
      for (int z=island.getMinProtectedZ(); z < (island.getMinProtectedZ() + island.getProtectionSize() + 16); z+=16) {
        chunkSnapshot.add(world.getBlockAt(x,0,z).getChunk().getChunkSnapshot());
      }
    }
    final Set<ChunkSnapshot> finalChunk=chunkSnapshot;
    final int worldHeight=world.getMaxHeight();
    plugin.getServer().getScheduler().runTaskAsynchronously(plugin,new Runnable(){
      @SuppressWarnings("String_Node_Str") @Override public void run(){
        HashMap<MaterialData,Integer> limitCount=new HashMap<MaterialData,Integer>();
        for (        MaterialData m : Settings.blockLimits.keySet()) {
          limitCount.put(m,Settings.blockLimits.get(m));
        }
        int blockCount=0;
        int underWaterBlockCount=0;
        for (        ChunkSnapshot chunk : finalChunk) {
          for (int x=0; x < 16; x++) {
            if (chunk.getX() * 16 + x < island.getMinProtectedX() || chunk.getX() * 16 + x >= island.getMinProtectedX() + island.getProtectionSize()) {
              continue;
            }
            for (int z=0; z < 16; z++) {
              if (chunk.getZ() * 16 + z < island.getMinProtectedZ() || chunk.getZ() * 16 + z >= island.getMinProtectedZ() + island.getProtectionSize()) {
                continue;
              }
              for (int y=0; y < worldHeight; y++) {
                int type=chunk.getBlockTypeId(x,y,z);
                int data=chunk.getBlockData(x,y,z);
                MaterialData md=new MaterialData(type,(byte)data);
                MaterialData generic=new MaterialData(type);
                if (type != 0) {
                  if (limitCount.containsKey(md) && Settings.blockValues.containsKey(md)) {
                    int count=limitCount.get(md);
                    if (count > 0) {
                      limitCount.put(md,--count);
                      if (y < Settings.sea_level) {
                        underWaterBlockCount+=Settings.blockValues.get(md);
                      }
 else {
                        blockCount+=Settings.blockValues.get(md);
                      }
                    }
                  }
 else                   if (limitCount.containsKey(generic) && Settings.blockValues.containsKey(generic)) {
                    int count=limitCount.get(generic);
                    if (count > 0) {
                      limitCount.put(md,--count);
                      if (y < Settings.sea_level) {
                        underWaterBlockCount+=Settings.blockValues.get(generic);
                      }
 else {
                        blockCount+=Settings.blockValues.get(generic);
                      }
                    }
                  }
 else                   if (Settings.blockValues.containsKey(md)) {
                    if (y < Settings.sea_level) {
                      underWaterBlockCount+=Settings.blockValues.get(md);
                    }
 else {
                      blockCount+=Settings.blockValues.get(md);
                    }
                  }
 else                   if (Settings.blockValues.containsKey(generic)) {
                    if (y < Settings.sea_level) {
                      underWaterBlockCount+=Settings.blockValues.get(generic);
                    }
 else {
                      blockCount+=Settings.blockValues.get(generic);
                    }
                  }
                }
              }
            }
          }
        }
        blockCount+=(int)((double)underWaterBlockCount * Settings.underWaterMultiplier);
        final int score=blockCount / Settings.levelCost;
        plugin.getServer().getScheduler().runTask(plugin,new Runnable(){
          @Override public void run(){
            int oldLevel=plugin.getPlayers().getIslandLevel(targetPlayer);
            plugin.getPlayers().setIslandLevel(targetPlayer,score);
            plugin.getPlayers().save(targetPlayer);
            if (plugin.getPlayers().inTeam(targetPlayer)) {
              for (              UUID member : plugin.getPlayers().getMembers(targetPlayer)) {
                plugin.getPlayers().setIslandLevel(member,score);
                plugin.getPlayers().save(member);
              }
            }
            if (!silent) {
              if (plugin.getPlayers().getIslandLevel(targetPlayer) > oldLevel) {
                plugin.getMessages().tellOfflineTeam(targetPlayer,ChatColor.GREEN + plugin.myLocale(targetPlayer).islandislandLevelis + "String_Node_Str"+ ChatColor.WHITE+ plugin.getPlayers().getIslandLevel(targetPlayer));
              }
              if (asker.isOnline()) {
                asker.sendMessage(ChatColor.GREEN + plugin.myLocale(asker.getUniqueId()).islandislandLevelis + "String_Node_Str"+ ChatColor.WHITE+ plugin.getPlayers().getIslandLevel(targetPlayer));
              }
            }
            if (!(asker.getUniqueId().equals(targetPlayer) && asker.hasPermission(Settings.PERMPREFIX + "String_Node_Str"))) {
              if (plugin.getPlayers().inTeam(targetPlayer)) {
                UUID leader=plugin.getPlayers().getTeamLeader(targetPlayer);
                if (leader != null) {
                  TopTen.topTenAddEntry(leader,score);
                }
              }
 else {
                TopTen.topTenAddEntry(targetPlayer,score);
              }
            }
            Island island=plugin.getGrid().getIsland(targetPlayer);
            final IslandLevelEvent event=new IslandLevelEvent(targetPlayer,island,score);
            plugin.getServer().getPluginManager().callEvent(event);
          }
        }
);
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * Calculates the level of an island
 * @param plugin
 * @param targetPlayer
 * @param asker
 */
public LevelCalcByChunk(final ASkyBlock plugin,final UUID targetPlayer,final Player asker,final boolean silent){
  final Island island=plugin.getGrid().getIsland(targetPlayer);
  if (island != null) {
    World world=plugin.getPlayers().getIslandLocation(targetPlayer).getWorld();
    Set<ChunkSnapshot> chunkSnapshot=new HashSet<ChunkSnapshot>();
    for (int x=island.getMinProtectedX(); x < (island.getMinProtectedX() + island.getProtectionSize() + 16); x+=16) {
      for (int z=island.getMinProtectedZ(); z < (island.getMinProtectedZ() + island.getProtectionSize() + 16); z+=16) {
        chunkSnapshot.add(world.getBlockAt(x,0,z).getChunk().getChunkSnapshot());
      }
    }
    final Set<ChunkSnapshot> finalChunk=chunkSnapshot;
    final int worldHeight=world.getMaxHeight();
    plugin.getServer().getScheduler().runTaskAsynchronously(plugin,new Runnable(){
      @SuppressWarnings("String_Node_Str") @Override public void run(){
        HashMap<MaterialData,Integer> limitCount=new HashMap<MaterialData,Integer>();
        for (        MaterialData m : Settings.blockLimits.keySet()) {
          limitCount.put(m,Settings.blockLimits.get(m));
        }
        int blockCount=0;
        int underWaterBlockCount=0;
        for (        ChunkSnapshot chunk : finalChunk) {
          for (int x=0; x < 16; x++) {
            if (chunk.getX() * 16 + x < island.getMinProtectedX() || chunk.getX() * 16 + x >= island.getMinProtectedX() + island.getProtectionSize()) {
              continue;
            }
            for (int z=0; z < 16; z++) {
              if (chunk.getZ() * 16 + z < island.getMinProtectedZ() || chunk.getZ() * 16 + z >= island.getMinProtectedZ() + island.getProtectionSize()) {
                continue;
              }
              for (int y=0; y < worldHeight; y++) {
                int type=chunk.getBlockTypeId(x,y,z);
                int data=chunk.getBlockData(x,y,z);
                MaterialData md=new MaterialData(type,(byte)data);
                MaterialData generic=new MaterialData(type);
                if (type != 0) {
                  if (limitCount.containsKey(md) && Settings.blockValues.containsKey(md)) {
                    int count=limitCount.get(md);
                    if (count > 0) {
                      limitCount.put(md,--count);
                      if (y <= Settings.sea_level) {
                        underWaterBlockCount+=Settings.blockValues.get(md);
                      }
 else {
                        blockCount+=Settings.blockValues.get(md);
                      }
                    }
                  }
 else                   if (limitCount.containsKey(generic) && Settings.blockValues.containsKey(generic)) {
                    int count=limitCount.get(generic);
                    if (count > 0) {
                      limitCount.put(md,--count);
                      if (y <= Settings.sea_level) {
                        underWaterBlockCount+=Settings.blockValues.get(generic);
                      }
 else {
                        blockCount+=Settings.blockValues.get(generic);
                      }
                    }
                  }
 else                   if (Settings.blockValues.containsKey(md)) {
                    if (y <= Settings.sea_level) {
                      underWaterBlockCount+=Settings.blockValues.get(md);
                    }
 else {
                      blockCount+=Settings.blockValues.get(md);
                    }
                  }
 else                   if (Settings.blockValues.containsKey(generic)) {
                    if (y <= Settings.sea_level) {
                      underWaterBlockCount+=Settings.blockValues.get(generic);
                    }
 else {
                      blockCount+=Settings.blockValues.get(generic);
                    }
                  }
                }
              }
            }
          }
        }
        blockCount+=(int)((double)underWaterBlockCount * Settings.underWaterMultiplier);
        final int score=blockCount / Settings.levelCost;
        plugin.getServer().getScheduler().runTask(plugin,new Runnable(){
          @Override public void run(){
            int oldLevel=plugin.getPlayers().getIslandLevel(targetPlayer);
            plugin.getPlayers().setIslandLevel(targetPlayer,score);
            plugin.getPlayers().save(targetPlayer);
            if (plugin.getPlayers().inTeam(targetPlayer)) {
              for (              UUID member : plugin.getPlayers().getMembers(targetPlayer)) {
                plugin.getPlayers().setIslandLevel(member,score);
                plugin.getPlayers().save(member);
              }
            }
            if (!silent) {
              if (plugin.getPlayers().getIslandLevel(targetPlayer) > oldLevel) {
                plugin.getMessages().tellOfflineTeam(targetPlayer,ChatColor.GREEN + plugin.myLocale(targetPlayer).islandislandLevelis + "String_Node_Str"+ ChatColor.WHITE+ plugin.getPlayers().getIslandLevel(targetPlayer));
              }
              if (asker.isOnline()) {
                asker.sendMessage(ChatColor.GREEN + plugin.myLocale(asker.getUniqueId()).islandislandLevelis + "String_Node_Str"+ ChatColor.WHITE+ plugin.getPlayers().getIslandLevel(targetPlayer));
              }
            }
            if (!(asker.getUniqueId().equals(targetPlayer) && asker.hasPermission(Settings.PERMPREFIX + "String_Node_Str"))) {
              if (plugin.getPlayers().inTeam(targetPlayer)) {
                UUID leader=plugin.getPlayers().getTeamLeader(targetPlayer);
                if (leader != null) {
                  TopTen.topTenAddEntry(leader,score);
                }
              }
 else {
                TopTen.topTenAddEntry(targetPlayer,score);
              }
            }
            Island island=plugin.getGrid().getIsland(targetPlayer);
            final IslandLevelEvent event=new IslandLevelEvent(targetPlayer,island,score);
            plugin.getServer().getPluginManager().callEvent(event);
          }
        }
);
      }
    }
);
  }
}