Package com.github.mafelp.accounts
Class AccountManager
java.lang.Object
com.github.mafelp.accounts.AccountManager
Manager for creating, saving and loading linked discord and minecraft accounts.
-
Field Summary
Modifier and TypeFieldDescriptionprivate static File
The file in which the accounts are saved.The list of all linked accounts -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddAccount(Account account)
Adds an Account to the list of linked accounts.static void
The method to create an account file.Gets all names of minecraft Players who have an account and all the usernames.The getter for the list of Linked Accounts.static void
The method that handles starting of the thread, which should load the accounts in.removeAccount(Account account)
Removes an account from the linked accounts.static void
The method that saves linkedAccounts to a JSON file.setLinkedAccounts(List<Account> set)
The setter for the list of Linked Accounts.
-
Field Details
-
linkedAccounts
The list of all linked accounts -
accountFile
The file in which the accounts are saved.
-
-
Constructor Details
-
AccountManager
public AccountManager()
-
-
Method Details
-
createAccountsFile
The method to create an account file.- Throws:
IOException
- the exception thrown, when the file could not be created, due to an error.
-
saveAccounts
The method that saves linkedAccounts to a JSON file.- Throws:
FileNotFoundException
- the exception thrown, when the file does not exists, we try to write to.
-
loadAccounts
The method that handles starting of the thread, which should load the accounts in.- Throws:
IOException
- The exception that is being thrown, if the accounts.json File does not exists or theAccountLoader
encounters anIOException
.
-
getLinkedAccounts
The getter for the list of Linked Accounts.- Returns:
- The linked Accounts list, currently used.
-
setLinkedAccounts
The setter for the list of Linked Accounts. This should only be used by this package!- Parameters:
set
- The List to set the linked accounts to.- Returns:
- the list, this method has set, aka. the input list.
-
addAccount
Adds an Account to the list of linked accounts.- Parameters:
account
- The account to add- Returns:
- the list of all linked Accounts.
-
removeAccount
Removes an account from the linked accounts.- Parameters:
account
- The account link to be removed- Returns:
- The now list of accounts.
-
getAllMinecraftAccountNames
Gets all names of minecraft Players who have an account and all the usernames.- Returns:
- The list of names and usernames.
-