diff --git a/src/main/java/cactusServer/models/Accounts.java b/src/main/java/cactusServer/models/Accounts.java index 9c2e5c6..092d95b 100644 --- a/src/main/java/cactusServer/models/Accounts.java +++ b/src/main/java/cactusServer/models/Accounts.java @@ -11,7 +11,7 @@ public class Accounts { private static Accounts theInstance = null; private HashMap accounts = new HashMap<>(); - private HashSet idlist = new HashSet(); + private HashSet idList = new HashSet(); private Accounts() { @@ -26,10 +26,11 @@ public Account createAcount(String userID, String userName, String userPass) { System.out.println(userName); - + if(!idList.add(userID)) { + return null; + } Account newAccount = new Account(userName, userPass); accounts.put(userID, newAccount); - idlist.add(userID); System.out.println(userID); return newAccount;