### Install and Setup mineflayer-griefergames Plugin Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt This snippet demonstrates how to install and set up the mineflayer-griefergames plugin with a Mineflayer bot. It includes creating the bot instance, loading the plugin, and waiting for the server to join before accessing plugin APIs. ```javascript const mineflayer = require('mineflayer') const griefergames = require('mineflayer-griefergames') // Create bot and load plugin let bot = mineflayer.createBot({ username: 'your-email@example.com', auth: 'microsoft', host: 'griefergames.net', port: 25565, version: '1.8.9' }) bot.loadPlugin(griefergames) // Wait for server join before using APIs bot.once('misc:serverInfo->join', async () => { console.log('Connected to GrieferGames!') // All bot.gg APIs are now available }) ``` -------------------------------- ### Load MysteryMod Spoof Addon for Mineflayer Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt Loads the MysteryMod spoof addon for mineflayer-griefergames to spoof MysteryMod client detection. This allows the bot to appear as if it has MysteryMod installed, potentially bypassing server restrictions. ```javascript const mineflayer = require('mineflayer') const griefergames = require('mineflayer-griefergames') let bot = mineflayer.createBot({ /* config */ }) bot.loadPlugin(griefergames) // Load MysteryMod spoof addon bot.loadPlugin(griefergames.mysteryModSpoof) // Makes the server think your bot has MysteryMod installed // Prevents certain restrictions on bot accounts ``` -------------------------------- ### Item Clear Event Tracking in JavaScript Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt Monitors upcoming item clear events and listens for notifications. Depends on bot event system; no external modules needed. Inputs: none beyond bot setup; outputs: timestamps, counts, and warnings via console/logs. Limitations: timing based on server events, may vary. ```javascript bot.once('misc:serverInfo->join', () => { // Check next item clear time console.log('Next item clear at:', bot.gg.itemClear.nextAt) // Returns JavaScript Date object or null const minutesUntilClear = bot.gg.itemClear.nextAt ? Math.floor((bot.gg.itemClear.nextAt - Date.now()) / 60000) : 'unknown' console.log(`Item clear in ${minutesUntilClear} minutes`) }) // Listen for item clear events bot.on('misc:itemClear', (removedItemsCount) => { console.log(`Item clear removed ${removedItemsCount} items`) console.log('Next clear at:', bot.gg.itemClear.nextAt) }) // Listen for specific time warnings bot.on('misc:itemClear->in:60', () => { console.log('Item clear in 60 seconds!') }) bot.on('misc:itemClear->in:10', () => { console.log('Item clear in 10 seconds!') }) ``` -------------------------------- ### Get Next Item Clear Time in JS Source: https://github.com/kaduvert/mineflayer-griefergames/blob/main/README.md Gets the timestamp of the next item clear event as a JavaScript Date. Requires bot.gg plugin. Input: none. Output: JS Date object. Limitations: Server-dependent, may not always be available. ```js bot.gg.itemClear.nextAt ``` -------------------------------- ### Get Plot Info in JS Source: https://github.com/kaduvert/mineflayer-griefergames/blob/main/README.md Retrieves information about the plot where the bot is currently standing. Depends on bot.gg plugin and bot position. Input: none (uses current position). Output: Promise containing plot data. Limitations: Bot must be on a valid plot. ```js console.log(await bot.gg.plot.fromPositionVarying().getInfo()) ``` -------------------------------- ### Switch to Server in JS Source: https://github.com/kaduvert/mineflayer-griefergames/blob/main/README.md Switches the bot to a specified game server on GrieferGames. Requires the mineflayer-griefergames plugin to be loaded and the bot to have joined the main server. Input: server name as a string. Output: Promise that resolves upon successful switch. Limitations: Must be executed after the 'misc:serverInfo->join' event. ```js await bot.gg.switch.to('cb22') ``` -------------------------------- ### Manage Homes (JavaScript) Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt Shows how to list available homes and teleport to a specific one using the homes API. Handles errors when homes are unavailable. Depends on the GrieferGames plugin and a server that supports homes. ```javascript bot.once('misc:serverInfo->join', async () => { try { // Get list of all homes const homes = await bot.gg.homes.get() console.log('Your homes:', homes) // ['home1', 'spawn', 'farm'] if (homes.length > 0) { // Teleport to first home await bot.gg.homes.teleportTo(homes[0]) console.log(`Teleported to ${homes[0]}`) } // Teleport to specific home await bot.gg.homes.teleportTo('farm') } catch (error) { console.error('Home operation failed:', error) } }) ``` -------------------------------- ### Auction House Management in JavaScript Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt Handles opening the auction house, browsing auctions, placing bids, and creating new listings. Depends on bot instance and prismarine-item module; requires server join event. Inputs: auction windows, items, prices; outputs: auction details and logs. Limitations: requires delays for UI interactions and valid inventory items. ```javascript bot.once('misc:serverInfo->join', async () => { // Open auction house const ahResult = await bot.gg.auctionHouse.open() const ahWindow = ahResult.getWindow() await bot.delay(500) // Get all active auctions in window const auctions = bot.gg.auctionHouse.getAuctions(ahWindow) auctions.forEach(auction => { console.log('Item:', auction.stack.displayName) console.log('Current bid: $' + auction.currentBid) console.log('Instant buy: $' + auction.immediatePurchasePrice) console.log('Time left:', auction.remainingTime) console.log('You are highest bidder:', auction.highestBidder) }) // Place custom bid on first auction if (auctions.length > 0) { const auctionWindow = await bot.gg.auctionHouse.getAuctionWindow( auctions[0], ahWindow ) // Bid $1000 await bot.gg.auctionHouse.bid(1000, auctionWindow.getWindow()) console.log('Bid placed!') // Or place bid limit (auto-rebid up to amount) await bot.gg.auctionHouse.bidLimit(5000, auctionWindow.getWindow()) } }) ``` ```javascript bot.once('misc:serverInfo->join', async () => { const Item = require('prismarine-item')(bot.version) // Get item from inventory to auction const itemToSell = bot.inventory.items().find( item => item.name === 'diamond' ) if (itemToSell) { await bot.gg.auctionHouse.createAuction( itemToSell, 100, // Start price: $100 24, // Duration: 24 hours null, // ahWindow (will auto-open) 500 // Instant buy price: $500 (null to disable) ) console.log('Auction created!') } }) ``` -------------------------------- ### Switch Between GrieferGames Servers Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt This code illustrates how to use the server switching API provided by mineflayer-griefergames. It allows bots to switch to specific CityBuild servers, retrieve server information, and check join eligibility. ```javascript bot.once('misc:serverInfo->join', async () => { try { // Switch to CityBuild server 22 await bot.gg.switch.to('cb22') console.log('Successfully switched to cb22') // Get server information before joining const serverInfo = bot.gg.switch.getServerInformation('cb1') console.log('CB1 Status:', serverInfo.onlineStatus) console.log('Players:', `${serverInfo.occupiedSlots}/${serverInfo.totalSlots}`) // Check if you can join a server (considers rank and slots) const canJoinCB1 = bot.gg.switch.canJoin('cb1') if (canJoinCB1) { await bot.gg.switch.to('cb1') } } catch (error) { console.error('Server switch failed:', error) } }) ``` -------------------------------- ### Load and Use Anti-AFK Addon for Mineflayer Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt Loads the anti-AFK addon for mineflayer-griefergames to automatically solve AFK challenge windows. It listens for the 'windowOpen:afk->challange' event and logs when a challenge is detected. ```javascript const mineflayer = require('mineflayer') const griefergames = require('mineflayer-griefergames') let bot = mineflayer.createBot({ /* config */ }) // Load main plugin bot.loadPlugin(griefergames) // Load anti-AFK addon bot.loadPlugin(griefergames.antiAfk) // The addon automatically detects and solves AFK challenges bot.on('windowOpen:afk->challange', (window) => { console.log('AFK challenge detected, auto-solving...') }) ``` -------------------------------- ### List Homes in JS Source: https://github.com/kaduvert/mineflayer-griefergames/blob/main/README.md Retrieves an array of the bot's homes. Requires bot.gg plugin. Input: none. Output: Promise of home objects. Limitations: Homes must be set on the server and bot must have access. ```js const homes = await bot.gg.homes.get() ``` -------------------------------- ### Manage Money (JavaScript) Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt Demonstrates how to retrieve the current balance, transfer money via chat actions, monitor real verified incoming payments, and log recent transactions. Depends on the GrieferGames plugin and the bot being connected to a GrieferGames server. ```javascript bot.once('misc:serverInfo->join', async () => { // Get current balance from scoreboard const balance = bot.gg.money.get() console.log('Current balance: $' + balance) // Transfer money using chat action const transferResult = await bot.gg.money.transfer('PlayerName', 100) if (transferResult.hasSucceeded()) { console.log('Successfully sent $100') } else { console.log('Transfer failed') } }) // Monitor received payments (with fake payment protection) bot.on('misc:money->received', (senderName, amount) => { console.log(`Received $${amount} from ${senderName}`) // This event only fires for REAL payments verified via scoreboard }) // Monitor payments from specific player bot.on('misc:money->received:TrustedPlayer', (amount) => { console.log(`TrustedPlayer sent: $${amount}`) }) // Access money transaction log console.log('Recent transactions:', bot.gg.money.log) // Each entry: { time: timestamp, difference: amount, used: boolean } ``` -------------------------------- ### Load Logging Addon for Mineflayer Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt Loads the logging addon for mineflayer-griefergames to enable comprehensive event and action logging. This addon is useful for debugging and development by logging chat patterns, events, window interactions, and state changes. ```javascript const mineflayer = require('mineflayer') const griefergames = require('mineflayer-griefergames') let bot = mineflayer.createBot({ /* config */ }) bot.loadPlugin(griefergames) // Load logging addon for debug output bot.loadPlugin(griefergames.logging) // Logs all chat patterns, events, window interactions, and state changes // Useful for debugging and development ``` -------------------------------- ### Player Information Utilities in JavaScript Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt Fetches player details like UUID, rank, prefix, and resolves nicknames. Depends on bot's player registry. Inputs: usernames or nicknames; outputs: player objects with properties. Limitations: availability depends on server data cache. ```javascript bot.once('misc:serverInfo->join', () => { // Get complete player info const playerInfo = bot.gg.getPlayerInfo('AbgegrieftHD') console.log('UUID:', playerInfo.uuid) console.log('Username:', playerInfo.username) console.log('Rank:', playerInfo.rank) // 'supreme', 'premium', etc. console.log('Prefix:', playerInfo.prefix) // Custom prefix or null // Resolve nickname to real username const realName = bot.gg.playerUtils.resolveNickname('~NickName123') console.log('Real username:', realName) // Get player's rank const rank = bot.gg.playerUtils.getRank('PlayerName') console.log('Rank:', rank) }) ``` -------------------------------- ### Bank Balance Access in JavaScript Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt Retrieves and listens for bank balance updates via server commands. Depends on bot chat and event handling. Inputs: none; outputs: balance value in dollars via events/console. Limitations: requires waiting for server response, async nature. ```javascript bot.once('misc:serverInfo->join', async () => { // Request bank balance (triggers command) await bot.gg.bank.getBalance() // Wait for balance update event await new Promise(resolve => { bot.once('chat:bank->balance', () => resolve()) }) console.log('Bank balance: $' + bot.gg.bank.balance) }) // Listen for balance updates bot.on('chat:bank->balance', () => { console.log('Bank balance updated: $' + bot.gg.bank.balance) }) ``` -------------------------------- ### Teleport to Home in JS Source: https://github.com/kaduvert/mineflayer-griefergames/blob/main/README.md Teleports the bot to a specified home. Depends on homes being fetched and bot.gg loaded. Input: home object from homes array. Output: Promise resolving when teleported. Limitations: Home must exist and be accessible. ```js await bot.gg.homes.teleportTo(homes[0]) ``` -------------------------------- ### Load and Use Chat Terminal Addon for Mineflayer Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt Loads the chat terminal addon for mineflayer-griefergames to enable an interactive terminal-based chat interface. Messages typed in the terminal are sent in-game, and incoming messages are displayed with formatting. ```javascript const mineflayer = require('mineflayer') const griefergames = require('mineflayer-griefergames') let bot = mineflayer.createBot({ /* config */ }) bot.loadPlugin(griefergames) // Load chat terminal addon bot.loadPlugin(griefergames.chatTerminal) // Now you can type messages in terminal that will be sent in-game // The terminal shows all incoming chat messages with proper formatting ``` -------------------------------- ### Send Chat Messages and Commands with Rate Limiting Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt This snippet demonstrates sending chat messages and commands using the mineflayer-griefergames chat API. It includes automatic rate limiting and fallible error handling for commands like payments. ```javascript bot.once('misc:serverInfo->join', async () => { // Send regular chat message (auto rate-limited) await bot.gg.chat.send('Hello everyone!') // Send command (auto rate-limited, max 3 per 3.5s) await bot.gg.chat.send('/money') // Send message explicitly as chat message await bot.gg.chat.sendMessage('This is a message') // Send command explicitly await bot.gg.chat.sendCommand('/homes') // Send with fallible error handling const result = await bot.gg.chat.sendFallible({ message: '/pay Player123 100', successEvent: 'chat:money->transferred', failureEvents: ['chat:money->insufficientError'] }) if (result.hasSucceeded()) { console.log('Payment successful') } else { console.log('Payment failed:', result.event) } }) ``` -------------------------------- ### Send and Receive Private Messages Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt This code shows how to send and receive private messages using the mineflayer-griefergames plugin. It covers sending single and split messages, and listening for incoming messages with auto-reply functionality. ```javascript // Send private message bot.once('misc:serverInfo->join', async () => { await bot.gg.privateChat.send('AbgegrieftHD', 'Hi there!') // Send long message (auto-splits at word boundaries) const longMessage = 'This is a very long message that will be automatically split into multiple messages because it exceeds the character limit for private messages' bot.gg.privateChat.splitSend('AbgegrieftHD', longMessage) }) // Listen for incoming private messages bot.on('misc:privateChat->receivedMessage', (username, message) => { console.log(`${username} sent: ${message}`) // Auto-reply bot.gg.privateChat.send(username, 'Thanks for your message!') }) // Listen for messages from specific player bot.on('misc:privateChat->receivedMessage:AbgegrieftHD', (message) => { console.log(`AbgegrieftHD said: ${message}`) }) ``` -------------------------------- ### Transfer Money in JS Source: https://github.com/kaduvert/mineflayer-griefergames/blob/main/README.md Transfers money to another player. Depends on bot.gg and sufficient funds. Input: recipient username (string), amount (number). Output: Promise. Limitations: Amount must be positive, recipient must exist, and bot must have enough money. ```js await bot.gg.money.transfer('AbgegrieftHD', 100) ``` -------------------------------- ### Teleport Request Handling in JavaScript Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt Listens for TPA requests and responds with accept/deny commands. Depends on bot chat system and event listeners. Inputs: player usernames via events; outputs: chat commands sent. Limitations: specific to TPA mechanics, no validation on requests. ```javascript bot.on('misc:tpa->request', (username) => { console.log(`${username} wants to teleport to you`) // Accept the request bot.gg.chat.send('/tpaccept') // Or deny it // bot.gg.chat.send('/tpdeny') }) // Listen for requests from specific player bot.on('misc:tpa->request:TrustedFriend', () => { console.log('TrustedFriend wants to teleport') bot.gg.chat.send('/tpaccept') }) ``` -------------------------------- ### Read Plot Info and Events (JavaScript) Source: https://context7.com/kaduvert/mineflayer-griefergames/llms.txt Demonstrates reading plot metadata from the current position or by plot ID, parsing IDs into coordinates, comparing plot IDs, and listening for player enter/exit events. Depends on the GrieferGames plot API and appropriate server permissions. ```javascript bot.once('misc:serverInfo->join', async () => { // Get info for plot at current position const plotInfo = await bot.gg.plot.fromPositionVarying().getInfo() if (plotInfo) { console.log('Plot ID:', plotInfo.id) // [x, z] coordinates console.log('Alias:', plotInfo.alias) // Custom plot name or null console.log('Owners:', plotInfo.owners) // Array of usernames console.log('Biome:', plotInfo.biome) // Current biome console.log('Helpers:', plotInfo.helpers) // Array of helper usernames console.log('Trusted:', plotInfo.trusted) // Array of trusted usernames console.log('Denied:', plotInfo.denied) // Array of denied usernames console.log('Flags:', plotInfo.flags) // Object with plot flags } // Get info for specific plot by ID const specificPlot = await bot.gg.plot.info.get('123;456') // Parse plot ID string to coordinates const coords = bot.gg.plot.info.parseId('123;456') // [123, 456] // Compare plot IDs const isSamePlot = bot.gg.plot.info.isEqualId([1, 2], [1, 2]) // true }) // Listen for plot enter/exit events bot.on('misc:plot->playerEntered', (plotId, username) => { console.log(`${username} entered plot [${plotId[0]}, ${plotId[1]}]`) }) bot.on('misc:plot->playerLeft', (plotId, username) => { console.log(`${username} left plot [${plotId[0]}, ${plotId[1]}]`) }) ``` -------------------------------- ### Send Chat Message in JS Source: https://github.com/kaduvert/mineflayer-griefergames/blob/main/README.md Sends a chat message while conforming to server spam limits. Depends on the bot.gg plugin being loaded. Input: message string. Output: Promise that resolves when sent. Limitations: Subject to GrieferGames chat spam restrictions. ```js await bot.gg.chat.send('hallo, ich bins!') ``` -------------------------------- ### Send Private Message in JS Source: https://github.com/kaduvert/mineflayer-griefergames/blob/main/README.md Sends a private message to another player. Requires the bot.gg plugin. Input: recipient username (string), message (string). Output: Promise resolving on send. Limitations: Recipient must be online and valid. ```js await bot.gg.privateChat.send('AbgegrieftHD', 'Hi') ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.