-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (32 loc) · 809 Bytes
/
index.js
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
const mineflayer = require("mineflayer");
const options = {
host: "mc.blockdrop.org",
username: "zinx",
version: "1.20",
};
const bot = mineflayer.createBot(options);
bot.once("login", () => {
console.log("Joined");
LoginF();
});
bot.on("message", (message) => {
console.log("[Chat/Server] " + message.toString());
});
function LoginF() {
bot.chat("/login zinx");
}
async function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
bot.once("spawn", async function () {
await sleep(1000);
bot.setQuickBarSlot(4);
await sleep(1000);
bot.activateItem();
await sleep(1000);
bot.clickWindow(14, 0, 0);
});
// Fixed event name from 'messagestr' to 'message'
bot.on("message", function (message) {
console.log("Received message:", message.toString());
});