forked from zombieb/galvanic-corrosion-rewrite
duhhhhhhhh
This commit is contained in:
@@ -59,15 +59,15 @@ class Profile {
|
||||
}
|
||||
|
||||
constructProfilePropertyKey(...keys: (string | undefined)[]) {
|
||||
return [ ProfileManagerBase.profilesKey, this.#id, ...keys.filter(val => typeof val == 'string') ];
|
||||
return [ProfileManagerBase.profilesKey, this.#id, ...keys.filter(val => typeof val == 'string')];
|
||||
}
|
||||
|
||||
getUsername() {
|
||||
return this.#selfAcc.username;
|
||||
}
|
||||
async setUsername(username: string) {
|
||||
this.#kv.getKv().delete([ ProfileManagerBase.profilesKey, this.#selfAcc.username ]);
|
||||
this.#kv.getKv().set([ ProfileManagerBase.profilesKey, username ], this.getId());
|
||||
this.#kv.getKv().delete([ProfileManagerBase.profilesKey, this.#selfAcc.username]);
|
||||
this.#kv.getKv().set([ProfileManagerBase.profilesKey, username], this.getId());
|
||||
|
||||
this.#selfAcc.username = username;
|
||||
await this.#saveSelfAcc();
|
||||
@@ -81,7 +81,7 @@ class Profile {
|
||||
await this.#saveSelfAcc();
|
||||
}
|
||||
|
||||
async getBio(){
|
||||
async getBio() {
|
||||
const key = this.constructProfilePropertyKey('bio');
|
||||
const val = await this.#kv.getKv().get<string>(key);
|
||||
if (!val.value) return null;
|
||||
@@ -136,7 +136,17 @@ class Profile {
|
||||
getInstance() {
|
||||
return this.#instance;
|
||||
}
|
||||
setInstance(inst: Instance) {
|
||||
updateInstance(inst: Instance | null) {
|
||||
if (inst == null) {
|
||||
if (this.#instance) this.#instance.removePlayer(this);
|
||||
this.#instance = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.#instance) this.#instance.removePlayer(this);
|
||||
inst.addPlayer(this);
|
||||
|
||||
this.#server.emit('presence.update', { profile: this, presence: this.#server.Presence.getPresence(this) });
|
||||
this.#instance = inst;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user