Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Discord = require('discord.js');
- var client = new Discord.Client;
- var vec3 = require('vec3');
- var Block=require("prismarine-block")("1.8");
- var mineflayer = require('mineflayer');
- var serverHost = 'cafe-mc.com'
- var Config = require('./Config.json');
- var prefix = Config.prefix;
- //var print1 = setInterval(print1, 900);
- client.on('message', (msg)=> {
- if(!msg.content.startsWith(Config.prefix)) return;
- if(!Config.whitelist.includes(msg.author.id)) return;
- let args = msg.content.slice(prefix.length).trim().split(" ");
- let cmd = args.shift().toLowerCase();
- switch(cmd){
- case "chat":
- bot.chat(args.join(" "))
- bot2.chat(args.join(" "))
- bot3.chat(args.join(" "))
- break;
- }
- })
- client.login(Config.token)
- var bot = mineflayer.createBot({
- host: serverHost,
- port: 25565,
- username: "scottcdowling@yahoo.com",
- password: "lofcannons123",
- version: "1.8.8"
- });
- var bot2 = mineflayer.createBot({
- host: serverHost,
- port: 25565,
- username: "codyblackops101@gmail.com",
- password: "Chicago56",
- version: "1.8.8"
- });
- var bot3 = mineflayer.createBot({
- host: serverHost,
- port: 25565,
- username: "masterald@mail.ru",
- password: "lofcannons123",
- version: "1.8.8"
- });
- function getBlocks(botId){
- let allFoundBlocks = [];
- let northBlocks = [];
- let southBlocks = [];
- let eastBlocks = [];
- let westBlocks = [];
- let foundBlocks = botId.findBlock({point: botId.entity.position, matching: Config.searchBlock, maxDistance: 6,})
- if(foundBlocks){
- for (i = 0; i < foundBlocks.length; i++) {
- switch(foundBlocks[i].metadata){
- case Config.north: northBlocks.push(foundBlocks[i]); break;
- case Config.south: southBlocks.push(foundBlocks[i]); break;
- case Config.east: eastBlocks.push(foundBlocks[i]); break;
- case Config.west: westBlocks.push(foundBlocks[i]); break;
- case Config.ns:
- northBlocks.push(foundBlocks[i])
- southBlocks.push(foundBlocks[i])
- break;
- case Config.ew:
- eastBlocks.push(foundBlocks[i])
- westBlocks.push(foundBlocks[i])
- break;
- }
- }
- allFoundBlocks.push(northBlocks, southBlocks, eastBlocks, westBlocks);
- return allFoundBlocks;
- } else {
- console.log(`[ERROR] No blocks matching the search pattern were found within a 5 block radius!`)
- }
- }
- function printTrue(message){
- let stringedMsg = `${message}`
- if(stringedMsg.includes("!print")){
- return true;
- } else {
- return false;
- }
- }
- function printStop(message){
- let stringedMsg = `${message}`
- if(stringedMsg.includes("!stop")){
- return true;
- } else {
- return false;
- }
- }
- function printSand(botID, nB, sB, eB, wB){
- if(nB){
- var vec = new vec3(0, 0, 1)
- let e;
- for (e = 0; e < nB.length; e++){
- botID.placeBlock(nB[e], vec)
- }
- }
- if(sB){
- var vec = new vec3(0, 0, -1)
- let e;
- for (e = 0; e < sB.length; e++){
- botID.placeBlock(sB[e], vec)
- }
- }
- if(eB){
- var vec = new vec3(-1, 0, 0)
- let e;
- for (e = 0; e < eB.length; e++){
- botID.placeBlock(eB[e], vec)
- }
- }
- if(wB){
- var vec = new vec3(1, 0, 0)
- let e;
- for (e = 0; e < wB.length; e++){
- botID.placeBlock(wB[e], vec)
- }
- }
- }
- bot.on('message', function(message) {
- let stop = printStop(message)
- let print = printTrue(message)
- if(print){
- let arrayedResults = getBlocks(bot);
- let nBlocks = arrayedResults[0]
- let sBlocks = arrayedResults[1]
- let eBlocks = arrayedResults[2]
- let wBlocks = arrayedResults[3]
- myVar = setInterval(printSand, Config.speed, bot, nBlocks, sBlocks, eBlocks, wBlocks)
- }
- if(stop){
- clearInterval(myVar)
- }
- });
- bot2.on('message', function(message) {
- let stop = printStop(message)
- let print = printTrue(message)
- if(print){
- let arrayedResults = getBlocks(bot2);
- let nBlocks = arrayedResults[0]
- let sBlocks = arrayedResults[1]
- let eBlocks = arrayedResults[2]
- let wBlocks = arrayedResults[3]
- myVar2 = setInterval(printSand, Config.speed, bot2, nBlocks, sBlocks, eBlocks, wBlocks)
- }
- if(stop){
- clearInterval(myVar2)
- }
- });
- bot3.on('message', function(message) {
- let stop = printStop(message)
- let print = printTrue(message)
- if(print){
- let arrayedResults = getBlocks(bot3);
- let nBlocks = arrayedResults[0]
- let sBlocks = arrayedResults[1]
- let eBlocks = arrayedResults[2]
- let wBlocks = arrayedResults[3]
- myVar3 = setInterval(printSand, Config.speed, bot3, nBlocks, sBlocks, eBlocks, wBlocks)
- }
- if(stop){
- clearInterval(myVar3)
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement