Class AccountManager
java.lang.Object
com.haven.havenplugin.accounts.AccountManager
Manages player accounts stored under
<pluginDataFolder>/data/userData/.
Directory layout
data/
playtime/UUIDs/
<username>.UUID — raw 32-hex UUID, no dashes (written by Playtime module)
userData/
users/
<UUID>/
accountInfo.json — creation timestamp, tracker, username
secrets.json — password hash + salt
dynamicData.json — lastLogin, alerts[]
Account creation / reset
- Client submits username + password via
newAccount(String). - Server hashes the password and stores a
AccountManager.PendingVerificationin memory along with a short random code. - The player runs
/onlineaccount verify <code>in-game.verifyAccount(String, String, String)matches the code, writes account files, and removes the pending entry. - If the account already exists the same flow applies, but only
secrets.jsonis overwritten (password reset).
Password hashing
262144 iterations of SHA3-512 over (previous || salt).
Result is standard Base64-encoded.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccountInfo(String token) Return merged account data for a valid token.accountStatus(String username) Return the account status for a username.voidaddUserAlert(String uuid, String alertType, String message) Append an alert to a user'sdynamicData.json.voidRemove expired pending verifications.static StringgetAccountSummary(String uuid, String username) Build a human-readable account summary for an online player.static StringhashPassword(String password, String salt) Log in with username + password and receive a token.newAccount(String base64data) Begin account creation or password reset.verifyAccount(String uuid, String username, String code) Complete verification from an in-game/onlineaccount verifycommand.
-
Constructor Details
-
AccountManager
-
-
Method Details
-
newAccount
Begin account creation or password reset.Expected base64url-encoded JSON payload:
{ "username": "...", "pwd": "...", "tracker": "..." }On success the player must run
/onlineaccount verify <code>in-game within 15 minutes to complete the flow.- Returns:
- JSON with
status:"pending"and thecodeto display - Throws:
Exception
-
verifyAccount
Complete verification from an in-game/onlineaccount verifycommand.Called by
OnlineAccountCommandon the main thread after the player submits their code.- Parameters:
uuid- 32-char UUID of the online playerusername- Current in-game name (stored in accountInfo.json on first creation)code- Code submitted by the player- Returns:
- Human-readable result to send as a chat message
-
login
-
accountStatus
-
accountInfo
-
getAccountSummary
-
addUserAlert
-
cleanupExpired
public void cleanupExpired()Remove expired pending verifications. Safe to call from any thread. -
hashPassword
-
generateSalt
-