configurable join messages! :D
This commit is contained in:
parent
3216aeac66
commit
4ad60ee9db
3 changed files with 17 additions and 6 deletions
|
@ -1,5 +1,13 @@
|
|||
const config = require("../config");
|
||||
module.exports = function(vanillaclient, client, server, data) {
|
||||
let translate = JSON.parse(data.message).translate;
|
||||
if(translate === "advMode.setCommand.success" && config.proxy.hideCBSet) return "cancel";
|
||||
module.exports = function (vanillaclient, client, server, data) {
|
||||
let msg = JSON.parse(data.message);
|
||||
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";
|
||||
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";
|
||||
if (msg.translate === "advMode.setCommand.success" && config.proxy.hideCBSet) return "cancel";
|
||||
};
|
|
@ -26,7 +26,10 @@ const config = {
|
|||
skin: "maniaplay", // set this to null if you dont want one
|
||||
nick: "&bma&dni&ra&dpl&bay", // set this to null if you dont want one
|
||||
prefix: "%" // set this to null if you dont want one
|
||||
|
||||
},
|
||||
messages: {
|
||||
playerJoin: "§e{player} §ejoined the game", //set to null to disable
|
||||
playerLeave: "§e{player} §eleft the game" //set to null/false to disable
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -36,8 +36,8 @@ function cmdBlock(client, cmd, depth = 3) {
|
|||
}, 100);
|
||||
}
|
||||
|
||||
function spawnBot(commands) {
|
||||
let tempC = mc.createClient(Object.assign({ username: r(8).toString("hex") }, config.client));
|
||||
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) {
|
||||
setTimeout(function () {
|
||||
|
|
Reference in a new issue