2023-12-17 14:55:27 -05:00
|
|
|
const CommandError = require('../CommandModules/command_error')
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
name: 'list',
|
|
|
|
description:['check the player list'],
|
2023-12-20 11:54:03 -05:00
|
|
|
trustLevel: 0,
|
2023-12-24 12:11:42 -05:00
|
|
|
aliases:['playerlist', 'plist', 'pl'],
|
2024-01-26 21:24:08 -05:00
|
|
|
async execute (context) {
|
2023-12-17 14:55:27 -05:00
|
|
|
const bot = context.bot
|
|
|
|
const args = context.arguments
|
|
|
|
const players = bot.players
|
|
|
|
const source = context.source
|
|
|
|
const component = []
|
|
|
|
// if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
|
|
|
if (args.length !== 0){
|
|
|
|
throw new CommandError({translate:"Too many Arguments!", color:"red"})
|
|
|
|
}
|
|
|
|
for (const player of players) {
|
|
|
|
component.push({
|
|
|
|
translate: '%s \u203a %s [%s] %s',
|
|
|
|
with: [
|
|
|
|
|
|
|
|
player.displayName ?? player.profile.name,
|
|
|
|
player.uuid,
|
|
|
|
{text: `Ping: ${player.latency}`, color:'green'},
|
|
|
|
player.gamemode
|
|
|
|
]
|
|
|
|
})
|
|
|
|
|
|
|
|
component.push('\n')
|
|
|
|
}
|
|
|
|
|
|
|
|
component.pop()
|
2024-01-26 21:24:08 -05:00
|
|
|
function sleep(ms) {
|
|
|
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
for (const player of players) {
|
|
|
|
component.push({
|
|
|
|
translate: '%s \u203a %s [%s] %s',
|
|
|
|
with: [
|
|
|
|
|
|
|
|
player.displayName ?? player.profile.name,
|
|
|
|
player.uuid,
|
|
|
|
{text: `Ping: ${player.latency}`, color:'green'},
|
|
|
|
player.gamemode
|
|
|
|
]
|
|
|
|
})
|
|
|
|
|
|
|
|
component.push('\n')
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
if(source.sources.console){
|
|
|
|
|
2024-01-26 22:31:41 -05:00
|
|
|
bot.console.info((bot.getMessageAsPrismarine(component)?.toAnsi())
|
2023-12-17 14:55:27 -05:00
|
|
|
|
2024-01-26 21:24:08 -05:00
|
|
|
}else
|
2024-01-27 10:54:48 -05:00
|
|
|
if(!bot.options.Core.enabled){
|
2024-01-26 21:24:08 -05:00
|
|
|
|
|
|
|
const ChatMessage = require('prismarine-chat')(bot.options.version)
|
|
|
|
for (const player of players){
|
|
|
|
|
|
|
|
bot.chat(ChatMessage.fromNotch(await sleep(500) ?? player.displayName ?? player.profile.name ).toMotd().replaceAll('§', '&') + `\u203a ${player.uuid} Ping: [&a${player.latency}&f]`)
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
|
2023-12-17 14:55:27 -05:00
|
|
|
source.sendFeedback(component, false)
|
2024-01-26 21:24:08 -05:00
|
|
|
|
2023-12-17 14:55:27 -05:00
|
|
|
}
|
|
|
|
}
|
2024-01-26 21:24:08 -05:00
|
|
|
}
|
2023-12-17 14:55:27 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//what is wi
|
|
|
|
// IDK
|