i give up i can't do it :(((((((

This commit is contained in:
ChomeNS 2022-11-11 18:17:50 +07:00
parent 678aa22e93
commit d0f16fd484

View file

@ -47,7 +47,7 @@ class TabCompletePlayerRequester {
constructor(bot) { constructor(bot) {
this.bot = bot; this.bot = bot;
bot.on('target_packet', (name, data) => { bot._client.on('target_packet', (name, data) => {
if (name !== 'tab_complete') return; if (name !== 'tab_complete') return;
const players = data.matches const players = data.matches
@ -107,10 +107,8 @@ function inject(bot, dcclient, config) {
}); });
function addPlayer(player, packet) { function addPlayer(player, packet) {
if (bot.options.host === 'sus.shhnowisnottheti.me') { // if (bot.players.getPlayer(player)) bot.emit('player_unvanished', player, packet);
if (bot.players.getPlayer(player)) bot.emit('player_unvanished', player, packet); // else bot.emit('player_added', player, packet);
else bot.emit('player_added', player, packet);
}
bot.players.addPlayer(player); bot.players.addPlayer(player);
} }
@ -146,19 +144,11 @@ function inject(bot, dcclient, config) {
} }
async function removePlayer(player, packet) { async function removePlayer(player, packet) {
if (bot.options.host === 'sus.shhnowisnottheti.me') { // const fullPlayer = bot.players.getPlayer(player);
const fullPlayer = bot.players.getPlayer(player); // const players = await bot.requester.getPlayerList();
//
const players = await bot.requester.getPlayerList(); // if (fullPlayer && players.some((name) => name === fullPlayer.name)) bot.emit('player_vanished', player);
/* else */bot.emit('player_removed', player, packet);
if (fullPlayer && players.some((name) => name === fullPlayer.name)) {
bot.emit('player_vanished', player);
return;
}
}
bot.emit('player_removed', player, packet);
bot.players.removePlayer(player); bot.players.removePlayer(player);
} }