Program: 33932
Project: 33932
Buggy source:
/** 
 * Calculates the level of an island
 * @param plugin
 * @param targetPlayer - UUID of island owner or team member
 * @param sender - requester of the level calculation, if anyone
 * @param silent - if true, calculation will be done silently
 * @param report - provide a report to the asker
 */
public LevelCalcByChunk(final ASkyBlock plugin,final UUID targetPlayer,final CommandSender sender,final boolean report){
  if (report && plugin.getServer().getVersion().contains("String_Node_Str")) {
    sender.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  final Island island=plugin.getGrid().getIsland(targetPlayer);
  if (island != null) {
    Player player=plugin.getServer().getPlayer(targetPlayer);
    int multiplier=1;
    if (player != null) {
      for (      PermissionAttachmentInfo perms : player.getEffectivePermissions()) {
        if (perms.getPermission().startsWith(Settings.PERMPREFIX + "String_Node_Str")) {
          multiplier=Math.max(multiplier,Integer.valueOf(perms.getPermission().split(Settings.PERMPREFIX + "String_Node_Str")[1]));
        }
        if (multiplier < 1) {
          multiplier=1;
        }
      }
    }
    final int levelMultiplier=multiplier;
    final int levelHandicap=island.getLevelHandicap();
    int deaths=plugin.getPlayers().getDeaths(targetPlayer);
    if (plugin.getPlayers().inTeam(targetPlayer)) {
      deaths=plugin.getPlayers().getDeaths(plugin.getPlayers().getTeamLeader(targetPlayer));
      if (Settings.sumTeamDeaths) {
        deaths=0;
        for (        UUID member : plugin.getPlayers().getMembers(targetPlayer)) {
          deaths+=plugin.getPlayers().getDeaths(member);
        }
      }
    }
    final int deathHandicap=deaths;
    final 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) {
        if (!world.getBlockAt(x,0,z).getChunk().isLoaded()) {
          world.getBlockAt(x,0,z).getChunk().load();
          chunkSnapshot.add(world.getBlockAt(x,0,z).getChunk().getChunkSnapshot());
          world.getBlockAt(x,0,z).getChunk().unload();
        }
 else {
          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(){
        File log=null;
        PrintWriter out=null;
        List<MaterialData> mdLog=null;
        List<MaterialData> uwLog=null;
        List<MaterialData> noCountLog=null;
        List<MaterialData> overflowLog=null;
        if (Settings.levelLogging) {
          log=new File(plugin.getDataFolder(),"String_Node_Str");
          try {
            if (log.exists()) {
              out=new PrintWriter(new FileWriter(log,true));
            }
 else {
              out=new PrintWriter(log);
            }
          }
 catch (          FileNotFoundException e) {
            System.out.println("String_Node_Str");
            e.printStackTrace();
          }
catch (          IOException e) {
            System.out.println("String_Node_Str");
            e.printStackTrace();
          }
        }
        if (Settings.levelLogging || report) {
          mdLog=new ArrayList<MaterialData>();
          uwLog=new ArrayList<MaterialData>();
          noCountLog=new ArrayList<MaterialData>();
          overflowLog=new ArrayList<MaterialData>();
        }
        HashMap<MaterialData,Integer> limitCount=new HashMap<MaterialData,Integer>(Settings.blockLimits);
        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 (Settings.sea_level > 0 && y <= Settings.sea_level) {
                        underWaterBlockCount+=Settings.blockValues.get(md);
                        if (Settings.levelLogging || report) {
                          uwLog.add(md);
                        }
                      }
 else {
                        blockCount+=Settings.blockValues.get(md);
                        if (Settings.levelLogging || report) {
                          mdLog.add(md);
                        }
                      }
                    }
 else                     if (Settings.levelLogging || report) {
                      overflowLog.add(md);
                    }
                  }
 else                   if (limitCount.containsKey(generic) && Settings.blockValues.containsKey(generic)) {
                    int count=limitCount.get(generic);
                    if (count > 0) {
                      limitCount.put(generic,--count);
                      if (Settings.sea_level > 0 && y <= Settings.sea_level) {
                        underWaterBlockCount+=Settings.blockValues.get(generic);
                        if (Settings.levelLogging || report) {
                          uwLog.add(md);
                        }
                      }
 else {
                        blockCount+=Settings.blockValues.get(generic);
                        if (Settings.levelLogging || report) {
                          mdLog.add(md);
                        }
                      }
                    }
 else                     if (Settings.levelLogging || report) {
                      overflowLog.add(md);
                    }
                  }
 else                   if (Settings.blockValues.containsKey(md)) {
                    if (Settings.sea_level > 0 && y <= Settings.sea_level) {
                      underWaterBlockCount+=Settings.blockValues.get(md);
                      if (Settings.levelLogging || report) {
                        uwLog.add(md);
                      }
                    }
 else {
                      blockCount+=Settings.blockValues.get(md);
                      if (Settings.levelLogging || report) {
                        mdLog.add(md);
                      }
                    }
                  }
 else                   if (Settings.blockValues.containsKey(generic)) {
                    if (Settings.sea_level > 0 && y <= Settings.sea_level) {
                      underWaterBlockCount+=Settings.blockValues.get(generic);
                      if (Settings.levelLogging || report) {
                        uwLog.add(md);
                      }
                    }
 else {
                      blockCount+=Settings.blockValues.get(generic);
                      if (Settings.levelLogging || report) {
                        mdLog.add(md);
                      }
                    }
                  }
 else                   if (Settings.levelLogging || report) {
                    noCountLog.add(md);
                  }
                }
              }
            }
          }
        }
        blockCount+=(int)((double)underWaterBlockCount * Settings.underWaterMultiplier);
        final int score=(((blockCount * levelMultiplier) - (deathHandicap * Settings.deathpenalty)) / Settings.levelCost) - levelHandicap;
        if (Settings.levelLogging || report) {
          Multiset<MaterialData> uwCount=HashMultiset.create(uwLog);
          Multiset<MaterialData> mdCount=HashMultiset.create(mdLog);
          Multiset<MaterialData> ncCount=HashMultiset.create(noCountLog);
          Multiset<MaterialData> ofCount=HashMultiset.create(overflowLog);
          reportLines.add("String_Node_Str" + island.getCenter());
          if (sender instanceof Player) {
            reportLines.add("String_Node_Str" + sender.getName() + "String_Node_Str"+ ((Player)sender).getUniqueId().toString()+ "String_Node_Str");
          }
 else {
            reportLines.add("String_Node_Str");
          }
          reportLines.add("String_Node_Str" + targetPlayer.toString());
          reportLines.add("String_Node_Str" + String.format("String_Node_Str",blockCount));
          reportLines.add("String_Node_Str" + Settings.levelCost);
          reportLines.add("String_Node_Str" + levelMultiplier + "String_Node_Str");
          reportLines.add("String_Node_Str" + levelHandicap + "String_Node_Str");
          reportLines.add("String_Node_Str" + (deathHandicap * Settings.deathpenalty) + "String_Node_Str"+ deathHandicap+ "String_Node_Str");
          reportLines.add("String_Node_Str" + score);
          reportLines.add("String_Node_Str");
          int total=0;
          if (!uwCount.isEmpty()) {
            reportLines.add("String_Node_Str" + Settings.underWaterMultiplier + "String_Node_Str");
            reportLines.add("String_Node_Str" + String.format("String_Node_Str",uwCount.size()));
            Iterable<Multiset.Entry<MaterialData>> entriesSortedByCount=Multisets.copyHighestCountFirst(uwCount).entrySet();
            Iterator<Entry<MaterialData>> it=entriesSortedByCount.iterator();
            while (it.hasNext()) {
              Entry<MaterialData> type=it.next();
              int value=0;
              if (Settings.blockValues.containsKey(type)) {
                value=Settings.blockValues.get(type);
              }
 else               if (Settings.blockValues.containsKey(new MaterialData(type.getElement().getItemType()))) {
                value=Settings.blockValues.get(new MaterialData(type.getElement().getItemType()));
              }
              if (value > 0) {
                reportLines.add(type.getElement().toString() + "String_Node_Str" + String.format("String_Node_Str",type.getCount())+ "String_Node_Str"+ value+ "String_Node_Str"+ (value * type.getCount()));
                total+=(value * type.getCount());
              }
            }
            reportLines.add("String_Node_Str" + total);
            reportLines.add("String_Node_Str");
          }
          reportLines.add("String_Node_Str");
          reportLines.add("String_Node_Str" + String.format("String_Node_Str",mdCount.size()));
          Iterable<Multiset.Entry<MaterialData>> entriesSortedByCount=Multisets.copyHighestCountFirst(mdCount).entrySet();
          Iterator<Entry<MaterialData>> it=entriesSortedByCount.iterator();
          while (it.hasNext()) {
            Entry<MaterialData> type=it.next();
            int value=0;
            if (Settings.blockValues.containsKey(type)) {
              value=Settings.blockValues.get(type);
            }
 else             if (Settings.blockValues.containsKey(new MaterialData(type.getElement().getItemType()))) {
              value=Settings.blockValues.get(new MaterialData(type.getElement().getItemType()));
            }
            if (value > 0) {
              reportLines.add(type.getElement().toString() + "String_Node_Str" + String.format("String_Node_Str",type.getCount())+ "String_Node_Str"+ value+ "String_Node_Str"+ (value * type.getCount()));
              total+=(value * type.getCount());
            }
          }
          reportLines.add("String_Node_Str" + total);
          reportLines.add("String_Node_Str");
          reportLines.add("String_Node_Str" + String.format("String_Node_Str",ofCount.size()));
          entriesSortedByCount=Multisets.copyHighestCountFirst(ofCount).entrySet();
          it=entriesSortedByCount.iterator();
          while (it.hasNext()) {
            Entry<MaterialData> type=it.next();
            Integer limit=Settings.blockLimits.get(type.getElement());
            String explain="String_Node_Str";
            if (limit == null) {
              MaterialData generic=new MaterialData(type.getElement().getItemType());
              limit=Settings.blockLimits.get(generic);
              explain="String_Node_Str";
            }
            reportLines.add(type.getElement().toString() + "String_Node_Str" + String.format("String_Node_Str",type.getCount())+ "String_Node_Str"+ limit+ explain);
          }
          reportLines.add("String_Node_Str");
          reportLines.add("String_Node_Str");
          reportLines.add("String_Node_Str" + String.format("String_Node_Str",ncCount.size()));
          entriesSortedByCount=Multisets.copyHighestCountFirst(ncCount).entrySet();
          it=entriesSortedByCount.iterator();
          while (it.hasNext()) {
            Entry<MaterialData> type=it.next();
            reportLines.add(type.getElement().toString() + "String_Node_Str" + String.format("String_Node_Str",type.getCount())+ "String_Node_Str");
          }
          reportLines.add("String_Node_Str");
        }
        if (out != null) {
          for (          String line : reportLines) {
            out.println(line);
          }
          System.out.println("String_Node_Str");
          out.close();
        }
        final int blocks=blockCount;
        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 (sender != null) {
              if (!(sender instanceof Player)) {
                if (!report) {
                  sender.sendMessage(ChatColor.GREEN + plugin.myLocale().islandislandLevelis + "String_Node_Str"+ ChatColor.WHITE+ plugin.getPlayers().getIslandLevel(targetPlayer));
                }
 else {
                  for (                  String line : reportLines) {
                    sender.sendMessage(line);
                  }
                }
              }
 else {
                if (!report) {
                  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 (sender instanceof Player && ((Player)sender).isOnline()) {
                    String message=ChatColor.GREEN + plugin.myLocale(((Player)sender).getUniqueId()).islandislandLevelis + "String_Node_Str"+ ChatColor.WHITE+ plugin.getPlayers().getIslandLevel(targetPlayer);
                    if (Settings.deathpenalty != 0) {
                      message+="String_Node_Str" + plugin.myLocale(((Player)sender).getUniqueId()).levelDeaths.replace("String_Node_Str",String.valueOf(plugin.getPlayers().getDeaths(targetPlayer)));
                    }
                    sender.sendMessage(message);
                    int requiredPoints=(Settings.levelCost * (plugin.getPlayers().getIslandLevel(targetPlayer) + 1)) - ((blocks * levelMultiplier) - (deathHandicap * Settings.deathpenalty));
                    String toNextLevel=ChatColor.GREEN + plugin.myLocale(((Player)sender).getUniqueId()).islandrequiredPointsToNextLevel.replace("String_Node_Str",String.valueOf(requiredPoints));
                    toNextLevel=toNextLevel.replace("String_Node_Str",String.valueOf(plugin.getPlayers().getIslandLevel(targetPlayer) + 1));
                    sender.sendMessage(toNextLevel);
                  }
                }
 else {
                  if (((Player)sender).isOnline()) {
                    for (                    String line : reportLines) {
                      sender.sendMessage(line);
                    }
                  }
                }
              }
            }
            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 - UUID of island owner or team member
 * @param sender - requester of the level calculation, if anyone
 * @param silent - if true, calculation will be done silently
 * @param report - provide a report to the asker
 */
public LevelCalcByChunk(final ASkyBlock plugin,final UUID targetPlayer,final CommandSender sender,final boolean report){
  if (report && plugin.getServer().getVersion().contains("String_Node_Str")) {
    sender.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  final Island island=plugin.getGrid().getIsland(targetPlayer);
  if (island != null) {
    Player player=plugin.getServer().getPlayer(targetPlayer);
    int multiplier=1;
    if (player != null) {
      for (      PermissionAttachmentInfo perms : player.getEffectivePermissions()) {
        if (perms.getPermission().startsWith(Settings.PERMPREFIX + "String_Node_Str")) {
          multiplier=Math.max(multiplier,Integer.valueOf(perms.getPermission().split(Settings.PERMPREFIX + "String_Node_Str")[1]));
        }
        if (multiplier < 1) {
          multiplier=1;
        }
      }
    }
    final int levelMultiplier=multiplier;
    final int levelHandicap=island.getLevelHandicap();
    int deaths=plugin.getPlayers().getDeaths(targetPlayer);
    if (plugin.getPlayers().inTeam(targetPlayer)) {
      deaths=plugin.getPlayers().getDeaths(plugin.getPlayers().getTeamLeader(targetPlayer));
      if (Settings.sumTeamDeaths) {
        deaths=0;
        for (        UUID member : plugin.getPlayers().getMembers(targetPlayer)) {
          deaths+=plugin.getPlayers().getDeaths(member);
        }
      }
    }
    final int deathHandicap=deaths;
    final 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) {
        if (!world.getBlockAt(x,0,z).getChunk().isLoaded()) {
          world.getBlockAt(x,0,z).getChunk().load();
          chunkSnapshot.add(world.getBlockAt(x,0,z).getChunk().getChunkSnapshot());
          world.getBlockAt(x,0,z).getChunk().unload();
        }
 else {
          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(){
        File log=null;
        PrintWriter out=null;
        List<MaterialData> mdLog=null;
        List<MaterialData> uwLog=null;
        List<MaterialData> noCountLog=null;
        List<MaterialData> overflowLog=null;
        if (Settings.levelLogging) {
          log=new File(plugin.getDataFolder(),"String_Node_Str");
          try {
            if (log.exists()) {
              out=new PrintWriter(new FileWriter(log,true));
            }
 else {
              out=new PrintWriter(log);
            }
          }
 catch (          FileNotFoundException e) {
            System.out.println("String_Node_Str");
            e.printStackTrace();
          }
catch (          IOException e) {
            System.out.println("String_Node_Str");
            e.printStackTrace();
          }
        }
        if (Settings.levelLogging || report) {
          mdLog=new ArrayList<MaterialData>();
          uwLog=new ArrayList<MaterialData>();
          noCountLog=new ArrayList<MaterialData>();
          overflowLog=new ArrayList<MaterialData>();
        }
        HashMap<MaterialData,Integer> limitCount=new HashMap<MaterialData,Integer>(Settings.blockLimits);
        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 (Settings.sea_level > 0 && y <= Settings.sea_level) {
                        underWaterBlockCount+=Settings.blockValues.get(md);
                        if (Settings.levelLogging || report) {
                          uwLog.add(md);
                        }
                      }
 else {
                        blockCount+=Settings.blockValues.get(md);
                        if (Settings.levelLogging || report) {
                          mdLog.add(md);
                        }
                      }
                    }
 else                     if (Settings.levelLogging || report) {
                      overflowLog.add(md);
                    }
                  }
 else                   if (limitCount.containsKey(generic) && Settings.blockValues.containsKey(generic)) {
                    int count=limitCount.get(generic);
                    if (count > 0) {
                      limitCount.put(generic,--count);
                      if (Settings.sea_level > 0 && y <= Settings.sea_level) {
                        underWaterBlockCount+=Settings.blockValues.get(generic);
                        if (Settings.levelLogging || report) {
                          uwLog.add(md);
                        }
                      }
 else {
                        blockCount+=Settings.blockValues.get(generic);
                        if (Settings.levelLogging || report) {
                          mdLog.add(md);
                        }
                      }
                    }
 else                     if (Settings.levelLogging || report) {
                      overflowLog.add(md);
                    }
                  }
 else                   if (Settings.blockValues.containsKey(md)) {
                    if (Settings.sea_level > 0 && y <= Settings.sea_level) {
                      underWaterBlockCount+=Settings.blockValues.get(md);
                      if (Settings.levelLogging || report) {
                        uwLog.add(md);
                      }
                    }
 else {
                      blockCount+=Settings.blockValues.get(md);
                      if (Settings.levelLogging || report) {
                        mdLog.add(md);
                      }
                    }
                  }
 else                   if (Settings.blockValues.containsKey(generic)) {
                    if (Settings.sea_level > 0 && y <= Settings.sea_level) {
                      underWaterBlockCount+=Settings.blockValues.get(generic);
                      if (Settings.levelLogging || report) {
                        uwLog.add(md);
                      }
                    }
 else {
                      blockCount+=Settings.blockValues.get(generic);
                      if (Settings.levelLogging || report) {
                        mdLog.add(md);
                      }
                    }
                  }
 else                   if (Settings.levelLogging || report) {
                    noCountLog.add(md);
                  }
                }
              }
            }
          }
        }
        blockCount+=(int)((double)underWaterBlockCount * Settings.underWaterMultiplier);
        final int score=(((blockCount * levelMultiplier) - (deathHandicap * Settings.deathpenalty)) / Settings.levelCost) - levelHandicap;
        if (Settings.levelLogging || report) {
          Multiset<MaterialData> uwCount=HashMultiset.create(uwLog);
          Multiset<MaterialData> mdCount=HashMultiset.create(mdLog);
          Multiset<MaterialData> ncCount=HashMultiset.create(noCountLog);
          Multiset<MaterialData> ofCount=HashMultiset.create(overflowLog);
          reportLines.add("String_Node_Str" + island.getCenter());
          if (sender instanceof Player) {
            reportLines.add("String_Node_Str" + sender.getName() + "String_Node_Str"+ ((Player)sender).getUniqueId().toString()+ "String_Node_Str");
          }
 else {
            reportLines.add("String_Node_Str");
          }
          reportLines.add("String_Node_Str" + targetPlayer.toString());
          reportLines.add("String_Node_Str" + String.format("String_Node_Str",blockCount));
          reportLines.add("String_Node_Str" + Settings.levelCost);
          reportLines.add("String_Node_Str" + levelMultiplier + "String_Node_Str");
          reportLines.add("String_Node_Str" + levelHandicap + "String_Node_Str");
          reportLines.add("String_Node_Str" + (deathHandicap * Settings.deathpenalty) + "String_Node_Str"+ deathHandicap+ "String_Node_Str");
          reportLines.add("String_Node_Str" + score);
          reportLines.add("String_Node_Str");
          int total=0;
          if (!uwCount.isEmpty()) {
            reportLines.add("String_Node_Str" + Settings.underWaterMultiplier + "String_Node_Str");
            reportLines.add("String_Node_Str" + String.format("String_Node_Str",uwCount.size()));
            Iterable<Multiset.Entry<MaterialData>> entriesSortedByCount=Multisets.copyHighestCountFirst(uwCount).entrySet();
            Iterator<Entry<MaterialData>> it=entriesSortedByCount.iterator();
            while (it.hasNext()) {
              Entry<MaterialData> type=it.next();
              int value=0;
              if (Settings.blockValues.containsKey(type)) {
                value=Settings.blockValues.get(type);
              }
 else               if (Settings.blockValues.containsKey(new MaterialData(type.getElement().getItemType()))) {
                value=Settings.blockValues.get(new MaterialData(type.getElement().getItemType()));
              }
              if (value > 0) {
                reportLines.add(type.getElement().toString() + "String_Node_Str" + String.format("String_Node_Str",type.getCount())+ "String_Node_Str"+ value+ "String_Node_Str"+ (value * type.getCount()));
                total+=(value * type.getCount());
              }
            }
            reportLines.add("String_Node_Str" + total);
            reportLines.add("String_Node_Str");
          }
          reportLines.add("String_Node_Str");
          reportLines.add("String_Node_Str" + String.format("String_Node_Str",mdCount.size()));
          Iterable<Multiset.Entry<MaterialData>> entriesSortedByCount=Multisets.copyHighestCountFirst(mdCount).entrySet();
          Iterator<Entry<MaterialData>> it=entriesSortedByCount.iterator();
          while (it.hasNext()) {
            Entry<MaterialData> type=it.next();
            int value=0;
            if (Settings.blockValues.containsKey(type)) {
              value=Settings.blockValues.get(type);
            }
 else             if (Settings.blockValues.containsKey(new MaterialData(type.getElement().getItemType()))) {
              value=Settings.blockValues.get(new MaterialData(type.getElement().getItemType()));
            }
            if (value > 0) {
              reportLines.add(type.getElement().toString() + "String_Node_Str" + String.format("String_Node_Str",type.getCount())+ "String_Node_Str"+ value+ "String_Node_Str"+ (value * type.getCount()));
              total+=(value * type.getCount());
            }
          }
          reportLines.add("String_Node_Str" + total);
          reportLines.add("String_Node_Str");
          reportLines.add("String_Node_Str" + String.format("String_Node_Str",ofCount.size()));
          entriesSortedByCount=Multisets.copyHighestCountFirst(ofCount).entrySet();
          it=entriesSortedByCount.iterator();
          while (it.hasNext()) {
            Entry<MaterialData> type=it.next();
            Integer limit=Settings.blockLimits.get(type.getElement());
            String explain="String_Node_Str";
            if (limit == null) {
              MaterialData generic=new MaterialData(type.getElement().getItemType());
              limit=Settings.blockLimits.get(generic);
              explain="String_Node_Str";
            }
            reportLines.add(type.getElement().toString() + "String_Node_Str" + String.format("String_Node_Str",type.getCount())+ "String_Node_Str"+ limit+ explain);
          }
          reportLines.add("String_Node_Str");
          reportLines.add("String_Node_Str");
          reportLines.add("String_Node_Str" + String.format("String_Node_Str",ncCount.size()));
          entriesSortedByCount=Multisets.copyHighestCountFirst(ncCount).entrySet();
          it=entriesSortedByCount.iterator();
          while (it.hasNext()) {
            Entry<MaterialData> type=it.next();
            reportLines.add(type.getElement().toString() + "String_Node_Str" + String.format("String_Node_Str",type.getCount())+ "String_Node_Str");
          }
          reportLines.add("String_Node_Str");
        }
        if (out != null) {
          for (          String line : reportLines) {
            out.println(line);
          }
          System.out.println("String_Node_Str");
          out.close();
        }
        final int blocks=blockCount;
        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 (sender != null) {
              if (!(sender instanceof Player)) {
                if (!report) {
                  sender.sendMessage(ChatColor.GREEN + plugin.myLocale().islandislandLevelis + "String_Node_Str"+ ChatColor.WHITE+ plugin.getPlayers().getIslandLevel(targetPlayer));
                }
 else {
                  for (                  String line : reportLines) {
                    sender.sendMessage(line);
                  }
                }
              }
 else {
                if (!report) {
                  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 (sender instanceof Player && ((Player)sender).isOnline()) {
                    String message=ChatColor.GREEN + plugin.myLocale(((Player)sender).getUniqueId()).islandislandLevelis + "String_Node_Str"+ ChatColor.WHITE+ plugin.getPlayers().getIslandLevel(targetPlayer);
                    if (Settings.deathpenalty != 0) {
                      message+="String_Node_Str" + plugin.myLocale(((Player)sender).getUniqueId()).levelDeaths.replace("String_Node_Str",String.valueOf(plugin.getPlayers().getDeaths(targetPlayer)));
                    }
                    sender.sendMessage(message);
                    int requiredPoints=(Settings.levelCost * (plugin.getPlayers().getIslandLevel(targetPlayer) + 1 + levelHandicap)) - ((blocks * levelMultiplier) - (deathHandicap * Settings.deathpenalty));
                    String toNextLevel=ChatColor.GREEN + plugin.myLocale(((Player)sender).getUniqueId()).islandrequiredPointsToNextLevel.replace("String_Node_Str",String.valueOf(requiredPoints));
                    toNextLevel=toNextLevel.replace("String_Node_Str",String.valueOf(plugin.getPlayers().getIslandLevel(targetPlayer) + 1));
                    sender.sendMessage(toNextLevel);
                  }
                }
 else {
                  if (((Player)sender).isOnline()) {
                    for (                    String line : reportLines) {
                      sender.sendMessage(line);
                    }
                  }
                }
              }
            }
            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);
          }
        }
);
      }
    }
);
  }
}