stuffAndThings
This commit is contained in:
@@ -7,26 +7,34 @@ import { Character } from "./character.js";
|
||||
* Contain persistent player account info.
|
||||
*/
|
||||
export class Player {
|
||||
/**
|
||||
* @protected
|
||||
* @type {string} unique username
|
||||
*/
|
||||
|
||||
/** @protected @type {string} unique username */
|
||||
_username;
|
||||
get username() {
|
||||
return this._username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {string}
|
||||
*/
|
||||
/** @protected @type {string} */
|
||||
_passwordHash;
|
||||
get passwordHash() {
|
||||
return this._passwordHash;
|
||||
}
|
||||
|
||||
/** @type {Date} */
|
||||
/** @protected @type {string} random salt used for hashing */
|
||||
_salt;
|
||||
get salt() {
|
||||
return this._salt;
|
||||
}
|
||||
|
||||
/** @protected @type {Date} */
|
||||
_createdAt = new Date();
|
||||
get createdAt() {
|
||||
return this._createdAt;
|
||||
}
|
||||
|
||||
/** @type {Date} */
|
||||
blockedUntil;
|
||||
|
||||
|
||||
/** @type {Date|null} Date of the player's last websocket message. */
|
||||
lastActivityAt = null;
|
||||
@@ -41,7 +49,7 @@ export class Player {
|
||||
failedPasswordsSinceLastLogin = 0;
|
||||
|
||||
/** @protected @type {Set<Character>} */
|
||||
_characters = new Set();
|
||||
_characters = new Set(); // should this be a WeakSet? After all if the player is removed, their items might remain in the system, right?
|
||||
get characters() {
|
||||
return this._characters;
|
||||
}
|
||||
@@ -49,11 +57,12 @@ export class Player {
|
||||
/**
|
||||
* @param {string} username
|
||||
* @param {string} passwordHash
|
||||
* @param {string} salt
|
||||
*/
|
||||
constructor(username, passwordHash) {
|
||||
constructor(username, passwordHash, salt) {
|
||||
this._username = username;
|
||||
this._passwordHash = passwordHash;
|
||||
|
||||
this._salt = salt;
|
||||
this._createdAt = new Date();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user