Compare commits

..
1 Commits
Author SHA1 Message Date
Parker2991 3041acc2cb Update index.js 2024-02-12 16:04:18 -05:00
2 changed files with 389 additions and 1020 deletions
+389 -988
View File
File diff suppressed because it is too large Load Diff
-32
View File
@@ -1,32 +0,0 @@
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