Merge pull request 'Merge self care tasks to selfcare plugin' (#1) from main into unload-global

Reviewed-on: 7cc5c4f330d47060/botvX#1
This commit is contained in:
7cc5c4f330d47060 2024-07-29 01:32:13 -04:00
commit c7e3e3deba
4 changed files with 35 additions and 48 deletions

View file

@ -1,15 +0,0 @@
module.exports = {
load: () => {
},
loadBot: (b) => {
b.add_sc_task('cspy', '/cspy on', true, true)
b.on('plainchat', (msg) => {
if (msg === 'Successfully disabled CommandSpy') {
b.sc_tasks.cspy.failed = 1
} else if (msg === 'Successfully enabled CommandSpy') {
b.sc_tasks.cspy.failed = 0
}
})
}
}

View file

@ -1,15 +0,0 @@
module.exports = {
load: () => {
},
loadBot: (b) => {
b.add_sc_task('gamemode', '/minecraft:gamemode creative', true)
b._client.on('game_state_change', (p) => {
if (p.reason === 3 && p.gameMode !== 1) {
b.sc_tasks.gamemode.failed = 1
} else if (p.reason === 3 && p.gameMode === 1) {
b.sc_tasks.gamemode.failed = 0
}
})
}
}

View file

@ -1,18 +0,0 @@
module.exports = {
load: () => {
},
loadBot: (b) => {
b.add_sc_task('op', '/op @s[type=player]', true)
b._client.on('login', (p) => {
b.entityId = p.entityId
})
b._client.on('entity_status', (p) => {
if (p.entityId === b.entityId && p.entityStatus === 24) {
b.sc_tasks.op.failed = 1
} else if (p.entityId === b.entityId && p.entityStatus === 28) {
b.sc_tasks.op.failed = 0
}
})
}
}

View file

@ -30,5 +30,40 @@ module.exports = {
b.add_sc_task = (name, failTask, chatCommand, startFailed) => {
b.sc_tasks[name] = new SCTask(failTask, chatCommand, startFailed)
}
// Selfcare tasks
// Operator
b.add_sc_task('op', '/op @s[type=player]', true)
b._client.on('login', (p) => {
b.entityId = p.entityId
})
b._client.on('entity_status', (p) => {
if (p.entityId === b.entityId && p.entityStatus === 24) {
b.sc_tasks.op.failed = 1
} else if (p.entityId === b.entityId && p.entityStatus === 28) {
b.sc_tasks.op.failed = 0
}
})
// Commandspy
b.add_sc_task('cspy', '/cspy on', true, true)
b.on('plainchat', (msg) => {
if (msg === 'Successfully disabled CommandSpy') {
b.sc_tasks.cspy.failed = 1
} else if (msg === 'Successfully enabled CommandSpy') {
b.sc_tasks.cspy.failed = 0
}
})
// Gamemode
b.add_sc_task('gamemode', '/minecraft:gamemode creative', true)
b._client.on('game_state_change', (p) => {
if (p.reason === 3 && p.gameMode !== 1) {
b.sc_tasks.gamemode.failed = 1
} else if (p.reason === 3 && p.gameMode === 1) {
b.sc_tasks.gamemode.failed = 0
}
})
}
}