Spaces:
Paused
Paused
Update index.js
Browse files23 unmodified lines242526272827282930313233353435365 unmodified lines4243444745464748495350515214 unmodified lines67686974707172777873747576771 unmodified line798081868283888423 unmodified lines } catch (e) { return "Lag..."; }}
function createAnarchyBot(name, partnerName, isProtector, delay = 0) { // Wait for the delay to avoid "Connection Throttled"function createBot(name, partnerName, isProtector, delay = 0) { setTimeout(() => { const bot = mineflayer.createBot({ host: 'umc.play.hosting', username: name, auth: 'offline', version: false, // Skip the internal physicTick check checkTimeoutInterval: 60000 });
5 unmodified lines const mcData = require('minecraft-data')(bot.version); bot.pathfinder.setMovements(new Movements(bot, mcData)); // Wait 5 seconds after spawn to register/login setTimeout(() => { bot.chat(`/register CouplePass123 CouplePass123`); bot.chat(`/login CouplePass123`); }, 5000);
// Movement Loop setInterval(() => { const partner = bot.players[partnerName]?.entity; if (isProtector) {14 unmodified lines } });
// RECONNECT LOGIC: If throttled, wait longer! bot.on('end', (reason) => { console.log(`${name} disconnected: ${reason}`); // If throttled, wait 30 seconds, otherwise 15 const waitTime = reason.includes('throttled') ? 30000 : 15000; setTimeout(() => createAnarchyBot(name, partnerName, isProtector, 0), waitTime); const waitTime = reason.toString().includes('throttled') ? 30000 : 15000; setTimeout(() => createBot(name, partnerName, isProtector, 0), waitTime); });
bot.on('error', (err) => console.log(`Error for ${name}:`, err));1 unmodified line }, delay);}
// Start with a 15-second gap between them to stop the throttling// Fixed the function calls here:createBot('sweetily', 'aprenda', false, 0); // GF joins firstcreateBot('aprenda', 'sweetily', true, 15000); // BF joins 15 seconds latercreateBot('aprenda', 'sweetily', true, 20000); // BF joins 20 seconds later to be safeindex.js+6-10