This commit is contained in:
Parker2991 2024-02-13 16:57:29 +00:00
parent da4f7e3f28
commit 4a8a25b064
2 changed files with 395 additions and 261 deletions

618
index.js

File diff suppressed because it is too large Load diff

32
modules/selfcare.js Normal file
View file

@ -0,0 +1,32 @@
function inject (bot) {
let permissionLevel = 4
let gamemode = 1
bot._client.on('entity_status', packet => {
if (packet.entityId !== bot.entity.id || packet.entityStatus < 24 || packet.entityStatus > 28) return
permissionLevel = packet.entityStatus - 24
})
bot._client.on('login', packet => {
gamemode = packet.gameMode
})
bot._client.on('game_state_change', packet => {
if (packet.reason === 3) gamemode = packet.gameMode
})
let timer
bot.on('login', () => {
timer = setInterval(() => {
if (permissionLevel < 2) bot.chat('/op @s[type=player]')
else if (gamemode !== 1) bot.chat('/gamemode creative')
}, 200)
})
bot.on('end', () => {
if (timer) clearInterval(timer)
})
}
module.exports = inject