diff --git a/src/main/java/cc/fascinated/piaservers/common/GitUtils.java b/src/main/java/cc/fascinated/piaservers/common/GitUtils.java index 9662a6c..3bc018c 100644 --- a/src/main/java/cc/fascinated/piaservers/common/GitUtils.java +++ b/src/main/java/cc/fascinated/piaservers/common/GitUtils.java @@ -11,6 +11,7 @@ public class GitUtils { * @param files The files to commit */ public static void commitFiles(String message, Path... files) { + System.out.println("Committing files"); if (System.getenv("ENVIRONMENT").equals("production")) { runCommand("git", "config", "--global", "user.email", "liam+pia-servers-ci@fascinated.cc"); runCommand("git", "config", "--global", "user.name", "PIA Servers CI"); @@ -27,6 +28,7 @@ public class GitUtils { */ public static void cloneRepo() { if (System.getenv("ENVIRONMENT").equals("production")) { + System.out.println("Cloning repository"); runCommand("git", "clone", "https://git.fascinated.cc/Fascinated/PIA-Servers.git"); } } diff --git a/src/main/java/cc/fascinated/piaservers/model/PiaServer.java b/src/main/java/cc/fascinated/piaservers/model/PiaServer.java index ced261d..d56e4aa 100644 --- a/src/main/java/cc/fascinated/piaservers/model/PiaServer.java +++ b/src/main/java/cc/fascinated/piaservers/model/PiaServer.java @@ -1,16 +1,19 @@ package cc.fascinated.piaservers.model; import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import java.util.Date; @AllArgsConstructor @Getter @Setter +@EqualsAndHashCode(onlyExplicitlyIncluded = true) public class PiaServer { /** * The IP of this server. */ + @EqualsAndHashCode.Include private final String ip; /** diff --git a/src/main/java/cc/fascinated/piaservers/pia/PiaManager.java b/src/main/java/cc/fascinated/piaservers/pia/PiaManager.java index 3b9da73..bc304e5 100644 --- a/src/main/java/cc/fascinated/piaservers/pia/PiaManager.java +++ b/src/main/java/cc/fascinated/piaservers/pia/PiaManager.java @@ -26,7 +26,7 @@ public class PiaManager { private static final HttpClient HTTP_CLIENT = HttpClient.newHttpClient(); private static final String PIA_OPENVPN_CONFIGS_URL = "https://www.privateinternetaccess.com/openvpn/openvpn.zip"; private static final long REMOVAL_THRESHOLD = TimeUnit.DAYS.toMicros(14); // 2 weeks - public static List SERVERS = new ArrayList<>(); + public static Set SERVERS = new HashSet<>(); @SneakyThrows public PiaManager() { @@ -38,7 +38,7 @@ public class PiaManager { // Load the serversFile from the file SERVERS = Main.GSON.fromJson(Files.readString(serversFile.toPath()), new TypeToken>() {}.getType()); if (SERVERS == null) { - SERVERS = new ArrayList<>(); + SERVERS = new HashSet<>(); } GitUtils.cloneRepo(); // Clone the repository