-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCommandManager.js
More file actions
40 lines (40 loc) · 932 Bytes
/
Copy pathCommandManager.js
File metadata and controls
40 lines (40 loc) · 932 Bytes
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
class CommandManager {
constructor(child) {
this.child = child;
}
SaveServer = () => {
return new Promise((resolve, reject) => {
this.child.stdin.write("save-all\n");
resolve();
});
};
StopServer = async () => {
return new Promise(async (resolve, reject) => {
console.log("Stopping server");
this.child.stdin.write("stop\n");
resolve("Server Stopped");
});
};
SaveServer = () => {
return new Promise((resolve, reject) => {
console.log("Saving server");
this.child.stdin.write("save-all\n");
resolve();
});
};
opPlayer = (name) => {
return new Promise((resolve, reject) => {
console.log("Opping Player");
this.child.stdin.write(`op ${name}\n`);
resolve();
});
};
onCommand = (command) => {
return new Promise((resolve, reject) => {
console.log("Issuing Command");
this.child.stdin.write(command + "\n");
resolve();
});
};
}
module.exports = CommandManager;