From d2e2124fbe8fb3534bd2d4c5a0f0ec5ef9eb923d Mon Sep 17 00:00:00 2001 From: Parker2991 Date: Thu, 11 Sep 2025 10:11:49 -0500 Subject: [PATCH] make the username selfcare use the player list --- src/modules/player_list.js | 2 +- src/selfcare/entity/username.js | 16 ++++++++++++++++ src/selfcare/extras/username.js | 24 ------------------------ 3 files changed, 17 insertions(+), 25 deletions(-) create mode 100644 src/selfcare/entity/username.js delete mode 100644 src/selfcare/extras/username.js diff --git a/src/modules/player_list.js b/src/modules/player_list.js index a700fa5..c8c099c 100644 --- a/src/modules/player_list.js +++ b/src/modules/player_list.js @@ -61,7 +61,7 @@ class player_list { displayName: undefined, vanished: false, }); - bot.emit('player_join', entry) + bot.emit('player_info', entry) } function initializeChat(entry) {} diff --git a/src/selfcare/entity/username.js b/src/selfcare/entity/username.js new file mode 100644 index 0000000..ed2d7bd --- /dev/null +++ b/src/selfcare/entity/username.js @@ -0,0 +1,16 @@ +class usernameSelfcare { + constructor(context) { + const bot = context.bot; + const options = context.options; + const config = context.config; + + bot.on('player_info', (data) => { + if (data.uuid === bot.uuid) { + if (data.player.name !== bot.username) bot.selfcare.username = true; + else bot.selfcare.username = false + } + }) + } +} + +module.exports = usernameSelfcare; diff --git a/src/selfcare/extras/username.js b/src/selfcare/extras/username.js deleted file mode 100644 index dd71c8c..0000000 --- a/src/selfcare/extras/username.js +++ /dev/null @@ -1,24 +0,0 @@ -class usernameSelfcare { - constructor(context) { - const bot = context.bot; - const options = context.options; - const stringMessage = context.stringMessage; - const config = context.config; - - if ( - stringMessage === - `Successfully set your username to "${bot._client.username}"` - ) { - bot.selfcare.username = false; - return; - } else if (stringMessage?.startsWith("Successfully set your username to ")) - bot.selfcare.username = true; - else if ( - stringMessage === - `You already have the username "${bot._client.username}"` - ) - bot.selfcare.username = false; - } -} - -module.exports = usernameSelfcare;