mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
fix player remove + use bot.players in *list
This commit is contained in:
parent
c1ae25270a
commit
de7904896f
3 changed files with 10 additions and 14 deletions
|
@ -11,9 +11,9 @@ module.exports = {
|
|||
try {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'Players:', color: 'green'}]));
|
||||
await sleep(60);
|
||||
for (const property of bot.tabcompleteplayers) {
|
||||
if (property.match.startsWith('@')) continue;
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: `${property.match}`, color: 'yellow'}, {text: ' › ', color: 'aqua'}, {text: `${bot.players.getPlayer(property.match).UUID}`, color: 'aqua'}]));
|
||||
for (const property of bot.players.list) {
|
||||
// if (property.match.startsWith('@')) continue;
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: `${property.name}`, color: 'yellow'}, {text: ' › ', color: 'aqua'}, {text: `${property.UUID}`, color: 'aqua'}]));
|
||||
}
|
||||
} catch (e) {
|
||||
return;
|
||||
|
@ -22,9 +22,9 @@ module.exports = {
|
|||
discordExecute: async function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
||||
try {
|
||||
let players = '';
|
||||
for (const property of bot.tabcompleteplayers) {
|
||||
if (property.match.startsWith('@')) continue;
|
||||
players += `\`${property.match}\` › \`${bot.players.getPlayer(property.match).UUID}\`` + '\n';
|
||||
for (const property of bot.players.list) {
|
||||
// if (property.match.startsWith('@')) continue;
|
||||
players += `\`${property.name}\` › \`${property.UUID}\`` + '\n';
|
||||
}
|
||||
const Embed = new MessageEmbed()
|
||||
.setColor('#FFFF00')
|
||||
|
|
4
index.js
4
index.js
|
@ -354,10 +354,6 @@ function main() {
|
|||
bot.getplayerusername[player.UUID] = player.name;
|
||||
});
|
||||
|
||||
bot.on('player_removed', (player) => {
|
||||
delete players[player.name];
|
||||
});
|
||||
|
||||
bot._client.on('end', function(reason) {
|
||||
bot.emit('end', reason, 'end');
|
||||
// onerror('end event: ' + util.inspect(reason).replaceAll('runner', 'chayapak1'));
|
||||
|
|
|
@ -107,8 +107,8 @@ function inject(bot) {
|
|||
});
|
||||
|
||||
function addPlayer(player, packet) {
|
||||
if (bot.players.getPlayer(player)) bot.emit('player_unvanished', player, packet);
|
||||
else bot.emit('player_added', player, packet);
|
||||
// if (bot.players.getPlayer(player)) bot.emit('player_unvanished', player, packet);
|
||||
/* else */bot.emit('player_added', player, packet);
|
||||
|
||||
bot.players.addPlayer(player);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ function inject(bot) {
|
|||
}
|
||||
|
||||
async function removePlayer(player, packet) {
|
||||
const fullPlayer = bot.players.getPlayer(player);
|
||||
/* const fullPlayer = bot.players.getPlayer(player);
|
||||
|
||||
const players = await bot.requester.getPlayerList();
|
||||
|
||||
|
@ -152,7 +152,7 @@ function inject(bot) {
|
|||
bot.emit('player_vanished', player);
|
||||
|
||||
return;
|
||||
}
|
||||
} */
|
||||
|
||||
bot.emit('player_removed', player, packet);
|
||||
|
||||
|
|
Loading…
Reference in a new issue