diff --git a/src/main/java/me/braydon/pia/readme/ReadMeManager.java b/src/main/java/me/braydon/pia/readme/ReadMeManager.java index 198c0caa1..dd81fec8c 100644 --- a/src/main/java/me/braydon/pia/readme/ReadMeManager.java +++ b/src/main/java/me/braydon/pia/readme/ReadMeManager.java @@ -10,6 +10,7 @@ import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; +import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; @@ -20,7 +21,8 @@ import java.util.Set; * @author Braydon */ public final class ReadMeManager { - private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MMMM d yyyy"); + private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#,##0"); + private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MMMM d yyyy h:m a"); /** * Copy the template README.md file from the jar @@ -39,7 +41,7 @@ public final class ReadMeManager { // Replace variables in the README.md file String contents = new String(Files.readAllBytes(localReadMe)); - contents = contents.replace("", String.valueOf(servers.size())); // Total servers variable + contents = contents.replace("", DECIMAL_FORMAT.format(servers.size())); // Total servers variable contents = contents.replace("", DATE_FORMAT.format(new Date()).replace(" ", "_")); // Total servers variable // Write the total servers per-region table @@ -47,6 +49,8 @@ public final class ReadMeManager { for (PIAServer server : servers) { regionCounts.put(server.getRegion(), regionCounts.getOrDefault(server.getRegion(), 0) + 1); } + contents = contents.replace("", DECIMAL_FORMAT.format(regionCounts.keySet().size())); // Total regions variable + contents = contents.replace("", regionCounts.entrySet().stream() .sorted((a, b) -> Integer.compare(b.getValue(), a.getValue())) // Sort from highest to lowest .map(entry -> "| " + StringUtils.capitalizeFully(entry.getKey(), '_') + " | " + entry.getValue() + " |") // Map the region to the count diff --git a/src/main/resources/README_TEMPLATE.md b/src/main/resources/README_TEMPLATE.md index bc0118844..23e485aac 100644 --- a/src/main/resources/README_TEMPLATE.md +++ b/src/main/resources/README_TEMPLATE.md @@ -1,5 +1,6 @@ ![Servers](https://img.shields.io/badge/Servers--darkgreen) -![Last Updated](https://img.shields.io/badge/Last_Updated--brightgreen) +![Last Updated](https://img.shields.io/badge/Last_Updated--darkgreen) +![Last Updated](https://img.shields.io/badge/Last_Updated--darkgreen) # PIA-ServerList An automatically updated list of IPs for PIA servers, this list is updated every hour, and servers in this list will be removed in they have not been seen in the last week.