-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.js
More file actions
100 lines (79 loc) · 2.89 KB
/
commands.js
File metadata and controls
100 lines (79 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
let processes = [];
function random(min, max) {
return Math.random() * (max - min) + min;
}
module.exports = [
{
name: 'process',
action: (bot, player, args) => {
if (args.length < 2) return;
switch (args[1]) {
case 'stop':
if (args.length < 3) return;
let process = processes.filter(pr => processes.indexOf(pr) == parseInt(args[2]))[0];
if (!process) {
bot.chat('> This process does not exist');
return;
}
processes = processes.filter(innerProcesss => process != innerProcesss);
clearInterval(process.id);
bot.chat(`> Stopping process ${args[2]}`);
break;
case 'list':
bot.chat(`> Listing processes ${processes.length}`);
processes.forEach(process => {
bot.chat(`> - ${processes.indexOf(process)}`);
bot.chat(`> ⠀⠀id: ${process.id}`);
bot.chat(`> ⠀⠀command: ${process.command}`);
bot.chat(`> `);
});
break;
}
}
},
{
name: 'bomb',
action: (bot, player, args) => {
if (args.length < 2) return;
let x = 0;
let y = 0;
let z = 0;
let material = args[1];
bot.chat(`> Starting process with id of ${processes.length} in 3 seconds`);
bot.chat(`> To stop this process type "process stop ${processes.length}"`);
setTimeout(() => {
let id = setInterval(() => {
let cmd = `/setblock ${x} ${y} ${z} minecraft:${material}`;
bot.chat(cmd);
x = random(0, 10);
y = random(200, 255);
z = random(0, 10);
}, 20);
processes.push({
id,
command: args.join(' ')
});
}, 3000);
}
},
{
name: 'spam',
action: (bot, player, args) => {
if (args.length < 3) return;
let text = args
.filter(arg => arg != args[0])
.filter(arg => arg != args[1])
.join(' ');
let delay = parseInt(args[1]);
bot.chat(`> Starting process with id of ${processes.length} in 3 seconds`);
bot.chat(`> To stop this process type "process stop ${processes.length}"`);
setTimeout(() => {
let id = setInterval(() => bot.chat(text), delay);
processes.push({
id,
command: args.join(' ')
});
}, 3000);
}
}
];