42 lines
781 B
JavaScript
42 lines
781 B
JavaScript
'use strict';
|
|
|
|
const conf = require('../conf');
|
|
const {sleep} = require('../utils');
|
|
|
|
class Tp{
|
|
constructor(args){
|
|
this.bot = args.bot;
|
|
}
|
|
|
|
async init(){
|
|
for(let pluginName in this.bot.plunginsLoaded){
|
|
if(this.bot.plunginsLoaded[pluginName].isDangerous){
|
|
this.bot.pluginUnload(pluginName);
|
|
this.pluginToContinue = pluginName;
|
|
}
|
|
}
|
|
|
|
await this.bot.goTo({
|
|
where: this.bot.findBlockBySign('bot TP spot'),
|
|
range: 0,
|
|
});
|
|
|
|
this.cleatTimeout = setTimeout(()=>{
|
|
this.bot.pluginUnload(this.constructor.name)
|
|
}, 60000);
|
|
|
|
}
|
|
|
|
unload(){
|
|
if(this.cleatTimeout){
|
|
clearTimeout(this.cleatTimeout);
|
|
this.cleatTimeout = undefined;
|
|
}
|
|
|
|
if(this.pluginToContinue) this.bot.pluginLoad(this.pluginToContinue);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
module.exports = Tp;
|