add shitcode
This commit is contained in:
parent
4ad60ee9db
commit
7331d397f8
12 changed files with 139 additions and 37 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
node_modules/
|
||||
config.js
|
||||
temp/
|
|
@ -4,10 +4,19 @@ module.exports = function (vanillaclient, client, server, data) {
|
|||
if (msg.translate === "multiplayer.player.joined" && config.proxy.messages.playerJoin) {
|
||||
vanillaclient.chat(config.proxy.messages.playerJoin.replace(/\{player\}/g, msg.with[0].insertion));
|
||||
return "cancel";
|
||||
} else if(msg.translate === "multiplayer.player.joined" && !config.proxy.messages.playerJoin) return "cancel";
|
||||
} else if (msg.translate === "multiplayer.player.joined" && !config.proxy.messages.playerJoin) return "cancel";
|
||||
if (msg.translate === "multiplayer.player.left" && config.proxy.messages.playerLeave) {
|
||||
vanillaclient.chat(config.proxy.messages.playerLeave.replace(/\{player\}/g, msg.with[0].text));
|
||||
return "cancel";
|
||||
} else if(msg.translate === "multiplayer.player.left" && !config.proxy.messages.playerLeave) return "cancel";
|
||||
} else if (msg.translate === "multiplayer.player.left" && !config.proxy.messages.playerLeave) return "cancel";
|
||||
if (msg.translate === "advMode.setCommand.success" && config.proxy.hideCBSet) return "cancel";
|
||||
|
||||
|
||||
if (msg.extra && msg.extra[0] && msg.extra[0].text === 'Vanish for '
|
||||
&& msg.extra[msg.extra.length - 1] && msg.extra[msg.extra.length - 1].text === ': disabled'
|
||||
&& config.proxy.joinCommands.vanish) {
|
||||
client.write('chat', { message: '/essentials:vanish enable' });
|
||||
setTimeout(()=>client.write('chat', { message: '/essentials:vanish enable' }),100);
|
||||
setTimeout(()=>client.write('chat', { message: '/essentials:vanish enable' }),400);
|
||||
}
|
||||
};
|
|
@ -11,7 +11,7 @@ module.exports = function (vanillaclient, client, server, data) {
|
|||
break;
|
||||
case 2: // Update latency
|
||||
if (!client.players[player.UUID]) return;
|
||||
client.players[player.UUID].latency = player.latency;
|
||||
client.players[player.UUID].ping = player.ping;
|
||||
break;
|
||||
case 3: // Update displayname, barely used
|
||||
if (!client.players[player.UUID]) return;
|
||||
|
|
|
@ -1,14 +1,21 @@
|
|||
function crashServer(client) {
|
||||
client.utils.cmdBlock(client, `sudo * kick @a ${".".repeat(256)} ${"@e".repeat(512)}`);
|
||||
client.chat('//fast on');
|
||||
client.chat('//pos1 -2147483648');
|
||||
client.chat('//pos2 -2147483648');
|
||||
client.chat('//set 34');
|
||||
client.chat('//set campfire');
|
||||
}
|
||||
|
||||
function crashClient(client, name) {
|
||||
client.utils.cmdBlock(client, `sudo ${name} particle minecraft:dust 0 0 0 9 ~ ~ ~ 0 0 0 1 2147483646 force`);
|
||||
client.utils.cmdBlock(client, `sudo ${name} tp ${Math.random().toString().substr(2, 4)} 100 ${Math.random().toString().substr(2, 4)}`);
|
||||
setTimeout(function () {
|
||||
client.utils.cmdBlock(client, `execute as ${name} run particle minecraft:dust 0 0 0 9 ~ ~ ~ 0 0 0 1 2147483646 force`);
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
module.exports.desc = "crash players/the server";
|
||||
module.exports.usage = "[player]";
|
||||
module.exports.exec = function (vanillaclient, client, server, args) {
|
||||
if(args.length === 0) return crashServer(client);
|
||||
if (args.length === 0) return crashServer(client);
|
||||
crashClient(client, args[0]);
|
||||
};
|
|
@ -1,4 +1,7 @@
|
|||
module.exports.desc = "spawns a bot to get you out of icu";
|
||||
module.exports.exec = function (vanillaclient, client, server, args) {
|
||||
client.utils.spawnBot(["/op @a","/setblock ~ ~ ~ command_block{Command:\"sudo * icu stop\",auto:1b}"]);
|
||||
client.utils.spawnBot(["/op @a", "/setblock ~ ~ ~ command_block{Command:\"sudo * icu stop\",auto:1b} destroy"]);
|
||||
setTimeout(function () {
|
||||
client.chat("/v on");
|
||||
}, 2000)
|
||||
};
|
4
index.js
4
index.js
|
@ -14,7 +14,7 @@ server.on("login", function (vanillaclient) {
|
|||
client.modules.push(module);
|
||||
});
|
||||
};
|
||||
|
||||
//client.on('packet', (p,m)=>console.log(`${require('util').inspect(m.name)}, ${require('util').inspect(p)}`))
|
||||
client.injectModules();
|
||||
|
||||
|
||||
|
@ -22,4 +22,4 @@ server.on("login", function (vanillaclient) {
|
|||
vanillaclient.on("error", () => client.end());
|
||||
client.on("end", () => vanillaclient.end());
|
||||
client.on("error", () => vanillaclient.end());
|
||||
});
|
||||
});
|
||||
|
|
|
@ -20,7 +20,7 @@ module.exports.inject = function (vanillaclient, client) {
|
|||
};
|
||||
};
|
||||
|
||||
module.exports.uninject = function(vanillaclient, client) {
|
||||
module.exports.uninject = function (vanillaclient, client) {
|
||||
vanillaclient.chat = undefined;
|
||||
client.chat = undefined;
|
||||
clearInterval(client.chatInterval);
|
|
@ -37,21 +37,24 @@ function cmdBlock(client, cmd, depth = 3) {
|
|||
}
|
||||
|
||||
function spawnBot(commands, username) {
|
||||
let tempC = mc.createClient(Object.assign({ username: username || r(8).toString("hex") }, config.client));
|
||||
tempC.on("login", function () {
|
||||
commands.forEach(function (command, i) {
|
||||
try {
|
||||
let tempC = mc.createClient(Object.assign({ username: username || r(8).toString("hex") }, config.client));
|
||||
tempC.on("login", function () {
|
||||
commands.forEach(function (command, i) {
|
||||
setTimeout(function () {
|
||||
tempC.write("chat", { message: command });
|
||||
}, i * 400);
|
||||
});
|
||||
setTimeout(function () {
|
||||
tempC.write("chat", { message: command });
|
||||
}, i * 400);
|
||||
if (tempC.serializer) {
|
||||
tempC.serializer.end();
|
||||
}
|
||||
tempC.socket.destroy();
|
||||
tempC = null;
|
||||
}, (commands.length * 400) + 100);
|
||||
});
|
||||
setTimeout(function () {
|
||||
if (tempC.serializer) {
|
||||
tempC.serializer.end();
|
||||
}
|
||||
tempC.socket.destroy();
|
||||
tempC = null;
|
||||
}, (commands.length * 400) + 100);
|
||||
});
|
||||
tempC.on('error', _ => { });
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
function componentToHex(c) {
|
||||
|
@ -67,12 +70,36 @@ function HSVtoHEX(h, s, v) {
|
|||
q = v * (1 - f * s);
|
||||
t = v * (1 - (1 - f) * s);
|
||||
switch (i % 6) {
|
||||
case 0: r = v; g = t; b = p; break;
|
||||
case 1: r = q; g = v; b = p; break;
|
||||
case 2: r = p; g = v; b = t; break;
|
||||
case 3: r = p; g = q; b = v; break;
|
||||
case 4: r = t; g = p; b = v; break;
|
||||
case 5: r = v; g = p; b = q; break;
|
||||
case 0:
|
||||
r = v;
|
||||
g = t;
|
||||
b = p;
|
||||
break;
|
||||
case 1:
|
||||
r = q;
|
||||
g = v;
|
||||
b = p;
|
||||
break;
|
||||
case 2:
|
||||
r = p;
|
||||
g = v;
|
||||
b = t;
|
||||
break;
|
||||
case 3:
|
||||
r = p;
|
||||
g = q;
|
||||
b = v;
|
||||
break;
|
||||
case 4:
|
||||
r = t;
|
||||
g = p;
|
||||
b = v;
|
||||
break;
|
||||
case 5:
|
||||
r = v;
|
||||
g = p;
|
||||
b = q;
|
||||
break;
|
||||
}
|
||||
|
||||
r = Math.round(r * 255);
|
||||
|
@ -82,7 +109,7 @@ function HSVtoHEX(h, s, v) {
|
|||
}
|
||||
|
||||
|
||||
function rainbowify(text) {
|
||||
function rainbowify(text, returnJson) {
|
||||
let res = [];
|
||||
let hue = 0;
|
||||
for (char of text.split('')) {
|
||||
|
@ -90,7 +117,7 @@ function rainbowify(text) {
|
|||
res.push({ text: char, color: `#${hex}` });
|
||||
hue += 1.0 / Math.max(text.length, 15);
|
||||
}
|
||||
|
||||
if (returnJson) return res;
|
||||
return JSON.stringify(res);
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ const config = require("../config");
|
|||
|
||||
module.exports.inject = function (vanillaclient, client, server) {
|
||||
|
||||
if(!client.loggedIn) client.on("login", function () {
|
||||
if (!client.loggedIn) client.on("login", function () {
|
||||
client.loggedIn = true;
|
||||
if (config.proxy.joinCommands.vanish) client.chat(`/essentials:vanish enable`);
|
||||
if (config.proxy.joinCommands.god) client.chat(`/essentials:god enable`);
|
49
modules/05_bossbar.js
Normal file
49
modules/05_bossbar.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
const UUID = require('uuid').v4();
|
||||
|
||||
function createBossbar(vanillaclient, name) {
|
||||
vanillaclient.write('boss_bar', {
|
||||
entityUUID: UUID,
|
||||
action: 0,
|
||||
title: typeof name === "string" ? JSON.stringify({ "text": name }) : JSON.stringify(name),
|
||||
health: 0,
|
||||
color: 6,
|
||||
dividers: 0,
|
||||
flags: 0
|
||||
});
|
||||
}
|
||||
|
||||
function changeName(vanillaclient, name) {
|
||||
vanillaclient.write('boss_bar', {
|
||||
entityUUID: UUID,
|
||||
action: 3,
|
||||
title: typeof name === "string" ? JSON.stringify({ "text": name }) : JSON.stringify(name),
|
||||
health: undefined,
|
||||
color: undefined,
|
||||
dividers: undefined,
|
||||
flags: undefined
|
||||
});
|
||||
}
|
||||
|
||||
function deleteBossbar(vanillaclient) {
|
||||
vanillaclient.write('boss_bar', {
|
||||
entityUUID: UUID,
|
||||
action: 1,
|
||||
title: undefined,
|
||||
health: undefined,
|
||||
color: undefined,
|
||||
dividers: undefined,
|
||||
flags: undefined
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.inject = function (vanillaclient, client) {
|
||||
createBossbar(vanillaclient, client.utils.rainbowify("Maniaplay's proxy v2", true));
|
||||
vanillaclient.bossbar = function (name) {
|
||||
changeName(vanillaclient, name);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.uninject = function (vanillaclient) {
|
||||
deleteBossbar(vanillaclient);
|
||||
vanillaclient.bossbar = undefined;
|
||||
};
|
|
@ -1,9 +1,9 @@
|
|||
module.exports.inject = function (vanillaclient, client) {
|
||||
client.opStatus = true;
|
||||
if(!client.entityId) client.entityId = 0;
|
||||
if (!client.entityId) client.entityId = 0;
|
||||
client.icuDetector = [0, 0];
|
||||
|
||||
if(client.entityId === 0) client.on("login", function (packet) {
|
||||
if (client.entityId === 0) client.on("login", function (packet) {
|
||||
client.entityId = packet.entityId;
|
||||
});
|
||||
|
||||
|
@ -16,10 +16,16 @@ module.exports.inject = function (vanillaclient, client) {
|
|||
client.icuInterval = setInterval(function () {
|
||||
let difference = client.icuDetector[0] - client.icuDetector[1];
|
||||
client.icuDetector[1] = client.icuDetector[0];
|
||||
if (difference > 18 && difference <= 22) client.utils.spawnBot(["/op @a","/setblock ~ ~ ~ command_block{Command:\"sudo * icu stop\",auto:1b}"]);
|
||||
if (difference > 18 && difference <= 22) {
|
||||
client.utils.spawnBot(["/op @a", "/setblock ~ ~ ~ command_block{Command:\"sudo * icu stop\",auto:1b} destroy"]);
|
||||
setTimeout(function () {
|
||||
client.chat("/v on");
|
||||
}, 2000);
|
||||
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
client.opHandler = function (packet) {
|
||||
client.opHandler = function (packet) {
|
||||
if (client.entityId !== packet.entityId) return;
|
||||
switch (packet.entityStatus) {
|
||||
case 24:
|
||||
|
@ -40,4 +46,4 @@ module.exports.uninject = function (vanillaclient, client) {
|
|||
client.off("entity_status", client.opHandler);
|
||||
client.positionHandler = undefined;
|
||||
client.opHandler = undefined;
|
||||
};
|
||||
};
|
Reference in a new issue