// images += getResourceString("webstats/image-items.css");
}
catch (IOException e) { return null; }
StringWriter transcript = new StringWriter();
TranscriptEvent endEvent = null;
for (TranscriptEvent e : match.getTranscript())
{
transcript.write(transcriptEventHTML(match, e));
if (e.getType() != TranscriptEvent.EventType.MATCH_END) endEvent = e;
}
AutoRefTeam win = match.getWinningTeam();
String winningTeam = (win == null) ? "??" :
String.format("<span class='team team-%s'>%s</span>",
getTag(win), ChatColor.stripColor(win.getDisplayName()));
Set<String> refList = Sets.newHashSet();
for (Player pl : match.getReferees())
refList.add(String.format("<span class='referee'>%s</span>", pl.getName()));
Set<String> streamerList = Sets.newHashSet();
for (Player pl : match.getStreamers())
streamerList.add(String.format("<span class='streamer'>%s</span>", pl.getName()));
List<String> extraRows = Lists.newLinkedList();
for (Map.Entry<String, String> e : this.customDetails.entrySet())
extraRows.add(String.format("<tr><th>%s</th><td>%s</td></tr>", e.getKey(), e.getValue()));
File mapImage = new File(match.getWorld().getWorldFolder(), "map.png");
if (!mapImage.exists()) match.saveMapImage();
Location ptMin = match.getMapCuboid().getMinimumPoint();
return (htm
// base files get replaced first
.replaceAll("#base-css#", css.replaceAll("\\s+", " ") + images)
.replaceAll("#base-js#", Matcher.quoteReplacement(js))
// followed by the team, player, and block styles
.replaceAll("#team-css#", getTeamStyles(match).replaceAll("\\s+", " "))
.replaceAll("#plyr-css#", getPlayerStyles(match).replaceAll("\\s+", " "))
.replaceAll("#blok-css#", getBlockStyles(match).replaceAll("\\s+", " "))
.replaceAll("#map-data#", String.format("{image:'%s', x:%d, z:%d}",
MapImageGenerator.imageToDataURI(mapImage, "image/png"), ptMin.getBlockX(), ptMin.getBlockZ()))
// then match and map names
.replaceAll("#title#", match.getMatchName())
.replaceAll("#map#", match.getMapName())
// date and length of match
.replaceAll("#date#", DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.FULL).format(new Date()))
.replaceAll("#length#", endEvent == null ? "??" : endEvent.getTimestamp())
// team information (all teams, and winning team)
.replaceAll("#teams#", getTeamList(match))
.replaceAll("#winners#", winningTeam)