mineflayer-swarm
    Preparing search index...

    Class Swarm

    Represents a swarm of mineflayer bots. Bots are removed from the swarm on disconnect.

    createSwarm to create a swarm object.

    Hierarchy

    • EventEmitter
      • Swarm
    Index

    Constructors

    • Parameters

      • options: Partial<ClientOptions>

      Returns Swarm

    Properties

    bots: SwarmBot[]
    options: Partial<ClientOptions>
    plugins: Record<string, Plugin>
    requirePlugin: Require = ...
    prefixed: string | boolean

    Methods

    • Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • fn: (...args: any[]) => void
      • Optionalcontext: any

      Returns this

    • Calls each of the listeners registered for a given event.

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • ...args: any[]

      Returns boolean

    • Return an array listing the events for which the emitter has registered listeners.

      Returns (string | symbol)[]

    • Check for the presence or absence of a plugin with a given name.

      Parameters

      • name: string

        The plugin to query for.

      Returns boolean

      Returns true if the given plugin is loaded in the swarm, otherwise returns false.

    • Check for the presence or absence of a member with a given name.

      Parameters

      • username: string

        The username to query for.

      Returns boolean

      Returns true if the given username is contained in the swarm, otherwise returns false.

    • Return the number of listeners listening to a given event.

      Parameters

      • event: string | symbol

      Returns number

    • Return the listeners registered for a given event.

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T

      Returns ((...args: any[]) => void)[]

    • Load a plugin

      Parameters

      • name: string

        The plugin to add.

      • Optionalplugin: Plugin

        DEPRECATED OPTION. WILL BE REMOVED IN A FUTURE RELEASE.

      Returns void

      Returns true if the given plugin is loaded in the swarm, otherwise returns false.

    • Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • Optionalfn: (...args: any[]) => void
      • Optionalcontext: any
      • Optionalonce: boolean

      Returns this

    • Add a listener for a given event.

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • fn: (...args: any[]) => void
      • Optionalcontext: any

      Returns this

    • Add a one-time listener for a given event.

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • fn: (...args: any[]) => void
      • Optionalcontext: any

      Returns this

    • Remove all listeners, or those of the specified event.

      Parameters

      • Optionalevent: string | symbol

      Returns this

    • Remove the listeners of a given event.

      Type Parameters

      • T extends string | symbol

      Parameters

      • event: T
      • Optionalfn: (...args: any[]) => void
      • Optionalcontext: any
      • Optionalonce: boolean

      Returns this