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