diff --git a/back/src/Model/GameRoom.ts b/back/src/Model/GameRoom.ts index ff8b7cf0..aefade43 100644 --- a/back/src/Model/GameRoom.ts +++ b/back/src/Model/GameRoom.ts @@ -312,7 +312,6 @@ export class GameRoom { } group.leave(user); if (group.isEmpty()) { - this.positionNotifier.leave(group); group.destroy(); if (!this.groups.has(group)) { throw new Error(`Could not find group ${group.getId()} referenced by user ${user.id} in World.`); diff --git a/back/src/Model/Group.ts b/back/src/Model/Group.ts index c35ac7a8..0782bd1b 100644 --- a/back/src/Model/Group.ts +++ b/back/src/Model/Group.ts @@ -141,6 +141,10 @@ export class Group implements Movable { * Usually used when there is only one user left. */ destroy(): void { + if (!this.outOfBounds) { + this.positionNotifier.leave(this); + } + for (const user of this.users) { this.leave(user); }