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

See

createSwarm to create a swarm object.

Hierarchy

  • EventEmitter
    • Swarm

Constructors

  • Parameters

    • options: Partial<ClientOptions>

    Returns Swarm

Properties

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

Methods

  • Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns this

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

    Parameters

    • auth: Partial<ClientOptions>

      The authentication information to create the swarm member with.

    Returns void

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

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • Rest ...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) => void)[]

  • Load a plugin

    Parameters

    • name: string

      The plugin to add.

    • Optional plugin: 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
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Add a listener for a given event.

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns this

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

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns this

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

    Parameters

    • Optional event: string | symbol

    Returns this

  • Remove the listeners of a given event.

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this