Update index.js
This commit is contained in:
parent
ec750a3b0a
commit
1b3f7b081a
1 changed files with 26 additions and 21 deletions
47
index.js
47
index.js
|
@ -19,13 +19,15 @@
|
|||
}
|
||||
|
||||
// hash functions
|
||||
host = process.argv[2];
|
||||
port = process.argv[3];
|
||||
function createTrustedHash () {
|
||||
TrustedHash = random(10);
|
||||
console.log(parseFormatCodes("&c[&6Hash&c] &6Trusted Hash: &c%s"), TrustedHash)
|
||||
console.log(parseFormatCodes("&c[&6Hash&c] &c[&6"+host +":"+ port+ "&c] &6Trusted Hash: &c%s"), TrustedHash)
|
||||
}
|
||||
function createOwnerHash () {
|
||||
OwnerHash = random(20);
|
||||
console.log(parseFormatCodes("&c[&6Hash&c] &6Owner Hash: &c%s"), OwnerHash)
|
||||
console.log(parseFormatCodes("&c[&6Hash&c] &c[&6"+host +":"+ port+ "&c] &6Owner Hash: &c%s"), OwnerHash)
|
||||
}
|
||||
|
||||
createTrustedHash()
|
||||
|
@ -55,14 +57,14 @@
|
|||
};
|
||||
|
||||
// bot creation
|
||||
function main () {
|
||||
function main (host, port) {
|
||||
var bots = [];
|
||||
|
||||
var client = mc.createClient
|
||||
(
|
||||
{
|
||||
host: "chipmunk.land",
|
||||
port: 25565,
|
||||
host: host,
|
||||
port: parseInt(port),
|
||||
username: randomEscape(10),
|
||||
version: "1.20"
|
||||
}
|
||||
|
@ -84,22 +86,22 @@ function main () {
|
|||
client.on("pos", () => {
|
||||
client.cmdCore.refillCmdCore()
|
||||
})
|
||||
}, 1000)
|
||||
}, 3000)
|
||||
|
||||
// chat logging
|
||||
client.on("playerChat", ({ senderName, plainMessage, unsignedContent, formattedMessage, verified }) => {
|
||||
try {
|
||||
var msg = new ChatMessage(JSON.parse(unsignedContent))
|
||||
console.log(parseFormatCodes("&c[&6Player Chat&c] ") + msg.toAnsi());
|
||||
console.log(parseFormatCodes("&c[&6Player Chat&c] &c[&6"+host +":"+ port+ "&c] " +msg.toAnsi() ));
|
||||
} catch (err) {
|
||||
console.log(parseFormatCodes("&c[&6Error&c] ") + err)
|
||||
console.log(parseFormatCodes("&c[&6Error&c] &c[&6"+host +":"+ port+ "&c] ") +err)
|
||||
}
|
||||
})
|
||||
client.on("systemChat", async ({ formattedMessage, positionId }) => {
|
||||
try {
|
||||
var msg = new ChatMessage(JSON.parse(formattedMessage))
|
||||
if (!String(msg).startsWith("Command set: ")) {
|
||||
console.log(parseFormatCodes("&c[&6System Chat&c] ") + msg.toAnsi());
|
||||
console.log(parseFormatCodes("&c[&6System Chat&c] &c[&6"+host +":"+ port+ "&c] ") +msg.toAnsi());
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(parseFormatCodes("&c[&6Error&c] ") + err)
|
||||
|
@ -118,8 +120,8 @@ function main () {
|
|||
if (!String(line).startsWith("§loghash")) {
|
||||
client.chat(line);
|
||||
} else {
|
||||
console.log(parseFormatCodes("&c[&6Hash&c] &6Trusted Hash: &c%s"), TrustedHash);
|
||||
console.log(parseFormatCodes("&c[&6Hash&c] &6Owner Hash: &c%s"), OwnerHash);
|
||||
console.log(parseFormatCodes("&c[&6Hash&c] &c[&6"+host +":"+ port+ "&c] &6Trusted Hash: &c%s"), TrustedHash);
|
||||
console.log(parseFormatCodes("&c[&6Hash&c] &c[&6"+host +":"+ port+ "&c] &6Owner Hash: &c%s"), OwnerHash);
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -325,6 +327,10 @@ function main () {
|
|||
}
|
||||
tellraw(`@a`, JSON.stringify(component))
|
||||
},
|
||||
loghash: () => {
|
||||
console.log(parseFormatCodes("&c[&6Hash&c] &c[&6"+host +":"+ port+ "&c] &6Trusted Hash: &c%s"), TrustedHash)
|
||||
console.log(parseFormatCodes("&c[&6Hash&c] &c[&6"+host +":"+ port+ "&c] &6Owner Hash: &c%s"), OwnerHash)
|
||||
},
|
||||
crash: (args) => {
|
||||
if (args[0] == "" +TrustedHash+ "") {
|
||||
client.cmdCore.run("minecraft:tellraw %s %s", args[1], exploits.crash_translate)
|
||||
|
@ -377,14 +383,13 @@ client.on("playerChat", chatListener);
|
|||
client.on("end", () => {
|
||||
client.off("playerChat", chatListener);
|
||||
});
|
||||
// on disconnect, rejoin
|
||||
client.on("error", async() => {
|
||||
await sleep(3000)
|
||||
main();
|
||||
})
|
||||
client.on("end", async() => {
|
||||
await sleep(3000)
|
||||
main();
|
||||
})
|
||||
|
||||
client.on("error", () => {
|
||||
main(process.argv[2], process.argv[3])
|
||||
})
|
||||
client.on("end", () => {
|
||||
main(process.argv[2], process.argv[3])
|
||||
})
|
||||
}
|
||||
main();
|
||||
|
||||
main(process.argv[2], process.argv[3]);
|
Loading…
Reference in a new issue