From 981bc13a1fb0ac66cbd188b744b401f1e72e4eb1 Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 28 Oct 2024 13:27:46 +0000 Subject: [PATCH] update player name --- projects/backend/src/service/player.service.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/backend/src/service/player.service.ts b/projects/backend/src/service/player.service.ts index 2df8aa7..b333bb2 100644 --- a/projects/backend/src/service/player.service.ts +++ b/projects/backend/src/service/player.service.ts @@ -67,6 +67,12 @@ export class PlayerService { // Wait for the player creation to complete player = await accountCreationLock[id]; + + // Update player name + if (player.name !== playerToken.name) { + player.name = playerToken.name; + await player.save(); + } } // Ensure that the player is now of type PlayerDocument