2025-05-07 07:27:41 -04:00
|
|
|
const sleep = require('../util/sleep')
|
|
|
|
|
|
2025-05-21 10:37:42 -04:00
|
|
|
class OwnerCheckModule {
|
|
|
|
|
constructor (context) {
|
|
|
|
|
const config = context.config
|
|
|
|
|
const bot = context.bot
|
|
|
|
|
const discordClient = context.discordClient
|
|
|
|
|
const options = context.options;
|
|
|
|
|
|
|
|
|
|
if (bot.options.mode === "savageFriends") return;
|
|
|
|
|
bot.ownerAuthed = false;
|
|
|
|
|
|
|
|
|
|
discordClient.on('messageCreate', (message) => {
|
|
|
|
|
if (message.content === `auth ${config.ownerAuth.uuid}` && message.channelId == config.ownerAuth.channel) {
|
|
|
|
|
message.reply(`Authenticated ${config.ownerAuth.uuid}`);
|
|
|
|
|
bot.ownerAuthed = true
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
bot.on('player_left', (data) => {
|
|
|
|
|
if (data[0] === `${config.ownerAuth.uuid}` && bot.ownerAuthed === true) {
|
|
|
|
|
bot.ownerAuthed = false
|
|
|
|
|
}
|
2025-05-07 07:27:41 -04:00
|
|
|
// console.log(data[0])
|
2025-05-21 10:37:42 -04:00
|
|
|
});
|
2025-05-07 07:27:41 -04:00
|
|
|
|
2025-05-21 10:37:42 -04:00
|
|
|
bot.on('message', async (data) => {
|
2025-05-07 07:27:41 -04:00
|
|
|
// console.log(bot.players);
|
|
|
|
|
// await sleep(1000)
|
|
|
|
|
|
2025-05-21 10:37:42 -04:00
|
|
|
for (const eachPlayer of bot.players) {
|
|
|
|
|
if (eachPlayer.uuid === `${config.ownerAuth.uuid}` && !bot.ownerAuthed) {
|
|
|
|
|
bot.core.run(`minecraft:deop @a[name="${eachPlayer.profile.name}"]`);
|
|
|
|
|
bot.core.run(`gamemode adventure @a[name="${eachPlayer.profile.name}"]`);
|
2025-05-07 07:27:41 -04:00
|
|
|
// bot.core.run(`mute ${eachPlayer.uuid} 10y not authenticated`);
|
2025-05-21 10:37:42 -04:00
|
|
|
bot.exploits.kicks.translateEntity(`${eachPlayer.profile.name}`);
|
|
|
|
|
}
|
2025-05-07 07:27:41 -04:00
|
|
|
}
|
2025-05-21 10:37:42 -04:00
|
|
|
});
|
2025-05-07 07:27:41 -04:00
|
|
|
|
2025-05-21 10:37:42 -04:00
|
|
|
bot.on('parsed_message', (data) => {
|
|
|
|
|
if (data?.sender?.uuid === `${config.ownerAuth.uuid}` && !bot.ownerAuthed) {
|
|
|
|
|
bot.core.run(`mute ${data.sender.uuid} 10y not authenticated`);
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-05-07 07:27:41 -04:00
|
|
|
|
2025-05-21 10:37:42 -04:00
|
|
|
bot.on('end', () => bot.ownerAuthed = false)
|
|
|
|
|
}
|
2025-05-07 07:27:41 -04:00
|
|
|
}
|
2025-05-21 10:37:42 -04:00
|
|
|
module.exports = OwnerCheckModule;
|