Interface FullServer

interface FullServer {
    _server: Server;
    ban: ((uuid, reason?) => Promise<boolean>);
    banUsername: ((username, reason) => Promise<boolean>);
    bannedPlayers: {};
    behavior: ((eventName, data?, func?, cancelFunc?) => Promise<any>);
    broadcast: ((message, opt?) => void);
    commands: Command.default;
    createLog: (() => void);
    doDaylightCycle: boolean;
    emitParticle: ((particle, world, position, __namedParameters?) => void);
    entities: Record<string, Entity>;
    entityMaxId: number;
    err: ((message) => void);
    getNearby: ((params) => Player[]);
    getNote: ((note) => number);
    getPlayer: ((username) => any);
    getUUIDFromUsername: ((username) => Promise<string>);
    info: ((message) => void);
    levelData?: LevelDatFull;
    log: ((message) => void);
    mcData: IndexedData;
    netherworld: CustomWorld;
    notifyNeighborsOfStateChange: ((world, pos, fromTick, tick, forceNotify?, data?) => void);
    notifyNeighborsOfStateChangeDirectional: ((world, pos, dir, fromTick, tick, forceNotify?, data?) => void);
    onBlockInteraction: ((name, handler) => void);
    onBlockUpdate: ((name, handler) => void);
    onItemPlace: ((name, handler, warn?) => void);
    overworld: CustomWorld;
    pardonUsername: ((username) => Promise<boolean>);
    playNoteBlock: ((pitch, world, position, __namedParameters?) => void);
    playSound: ((sound, world, position, __namedParameters?) => void);
    players: Player[];
    plugins: {};
    pluginsReady: boolean;
    selectorString: ((str, pos?, world?, allowUser?, ctxEntityId?) => Entity[]);
    setBlock: ((world, position, stateId) => Promise<void>);
    setBlockAction: ((world, position, actionId, actionParam) => Promise<void>);
    setTickInterval: ((ticksPerSecond) => void);
    setTime: ((time) => void);
    spawnPoint?: Vec3;
    supportFeature: ((feature) => boolean);
    tabComplete: {
        add: ((id, cb) => void);
        types: any[];
        use: ((id, otherData?, existingContent?) => void);
    };
    tickCount: number;
    time: number;
    updateBlock: ((world, pos, fromTick, tick, forceNotify?, data?) => void);
    uuidToPlayer: {};
    warn: ((message) => void);
    addListener<E>(event, listener): this;
    emit<E>(event, ...args): boolean;
    eventNames(): (string | symbol)[];
    formatMessage(message): any;
    getMaxListeners(): number;
    listenerCount<E>(event): number;
    listeners<E>(event): Function[];
    off<E>(event, listener): this;
    on<E>(event, listener): this;
    once<E>(event, listener): this;
    prependListener<E>(event, listener): this;
    prependOnceListener<E>(event, listener): this;
    rawListeners<E>(event): Function[];
    removeAllListeners<E>(event?): this;
    removeListener<E>(event, listener): this;
    setMaxListeners(maxListeners): this;
}

Hierarchy

  • Server
    • FullServer

Properties

_server: Server
ban: ((uuid, reason?) => Promise<boolean>)

Ban player given a uuid. If the player is online, using player.ban(). Bans with reason or You are banned!.

Type declaration

    • (uuid, reason?): Promise<boolean>
    • Ban player given a uuid. If the player is online, using player.ban(). Bans with reason or You are banned!.

      Parameters

      • uuid: string
      • Optional reason: string

      Returns Promise<boolean>

banUsername: ((username, reason) => Promise<boolean>)

Bans players given a username. Mainly used if player is not online, otherwise use player.ban().

Type declaration

    • (username, reason): Promise<boolean>
    • Bans players given a username. Mainly used if player is not online, otherwise use player.ban().

      Parameters

      • username: string
      • reason: string

      Returns Promise<boolean>

bannedPlayers: {}

Object of players that are banned, key is their uuid. Use () getUUIDFromUsername() if you only have their username.

Example player:

{
time: <time in epoch>,
reason: <reason given>
}

Type declaration

    behavior: ((eventName, data?, func?, cancelFunc?) => Promise<any>)

    Type declaration

      • (eventName, data?, func?, cancelFunc?): Promise<any>
      • Parameters

        • eventName: string
        • Optional data: any
        • Optional func: Function
        • Optional cancelFunc: Function

        Returns Promise<any>

    broadcast: ((message, opt?) => void)

    Broadcasts message to all the players with the optional color.

    Type declaration

      • (message, opt?): void
      • Broadcasts message to all the players with the optional color.

        Parameters

        • message: any
        • Optional opt: {
              blacklist?: any[];
              system?: boolean;
              whitelist?: any;
          }
          • Optional blacklist?: any[]
          • Optional system?: boolean
          • Optional whitelist?: any

        Returns void

    commands: Command.default
    createLog: (() => void)

    Creates the log file

    Type declaration

      • (): void
      • Creates the log file

        Returns void

    doDaylightCycle: boolean

    Default true. If false, time will not automatically pass.

    emitParticle: ((particle, world, position, __namedParameters?) => void)

    Emits particle (see id list) at position in world.

    Opt:

    • whitelist: Array of players that can see the particle (can be a player object)
    • blacklist: Array of players who cannot see the particle
    • radius: Radius that the particle can be seen from
    • longDistance: I don't know what this is. I think this is pointless with our implenetation of radius, not sure though...
    • size: vec3 of the size. (0,0,0) will be at an exact position, (10,10,10) will be very spread out (particles less dense)
    • count: Number of particles. 100,000,000+ will crash the client. Try not to go over 100,000 (sincerely, minecraft clients)

    Type declaration

      • (particle, world, position, __namedParameters?): void
      • Emits particle (see id list) at position in world.

        Opt:

        • whitelist: Array of players that can see the particle (can be a player object)
        • blacklist: Array of players who cannot see the particle
        • radius: Radius that the particle can be seen from
        • longDistance: I don't know what this is. I think this is pointless with our implenetation of radius, not sure though...
        • size: vec3 of the size. (0,0,0) will be at an exact position, (10,10,10) will be very spread out (particles less dense)
        • count: Number of particles. 100,000,000+ will crash the client. Try not to go over 100,000 (sincerely, minecraft clients)

        Parameters

        • particle: any
        • world: any
        • position: any
        • Optional __namedParameters: {
              blacklist?: any[];
              count?: number;
              longDistance?: boolean;
              radius?: number;
              size?: any;
              whitelist?: any;
          }
          • Optional blacklist?: any[]
          • Optional count?: number
          • Optional longDistance?: boolean
          • Optional radius?: number
          • Optional size?: any
          • Optional whitelist?: any

        Returns void

    entities: Record<string, Entity>

    All of the entities

    entityMaxId: number

    The current maximum ID (i.e. the last entity that was spawned has that id)

    err: ((message) => void)

    Logs a message as error

    Type declaration

      • (message): void
      • Logs a message as error

        Parameters

        • message: any

        Returns void

    getNearby: ((params) => Player[])

    Returns array of players within loc. loc is a required paramater. The object contains:

    • world: World position is in
    • position: Center position
    • radius: Distance from position

    Type declaration

      • (params): Player[]
      • Returns array of players within loc. loc is a required paramater. The object contains:

        • world: World position is in
        • position: Center position
        • radius: Distance from position

        Parameters

        • params: {
              position: Vec3;
              radius?: number;
              world: CustomWorld;
          }
          • position: Vec3
          • Optional radius?: number
          • world: CustomWorld

        Returns Player[]

    getNote: ((note) => number)

    Get pitch. note should be between 0-24 and your output is from 0.5 to 2.0

    Type declaration

      • (note): number
      • Get pitch. note should be between 0-24 and your output is from 0.5 to 2.0

        Parameters

        • note: any

        Returns number

    getPlayer: ((username) => any)

    Returns player object with that username or, if no such player is on the server, null.

    Type declaration

      • (username): any
      • Returns player object with that username or, if no such player is on the server, null.

        Parameters

        • username: any

        Returns any

    getUUIDFromUsername: ((username) => Promise<string>)

    Gets UUID from username. Since it needs to fetch from mojang servers, it is not immediate.

    Arguments in format: callback(uuid). uuid is null if no such username exists.

    Type declaration

      • (username): Promise<string>
      • Gets UUID from username. Since it needs to fetch from mojang servers, it is not immediate.

        Arguments in format: callback(uuid). uuid is null if no such username exists.

        Parameters

        • username: string

        Returns Promise<string>

    info: ((message) => void)

    Logs a message as info

    Type declaration

      • (message): void
      • Logs a message as info

        Parameters

        • message: any

        Returns void

    levelData?: LevelDatFull

    Parsed level.dat of the loaded world (only if worldFolder is specificed)

    log: ((message) => void)

    Logs a message

    Type declaration

      • (message): void
      • Logs a message

        Parameters

        • message: any

        Returns void

    mcData: IndexedData
    netherworld: CustomWorld

    Contains the nether world. This WILL be used when a player travels through a portal if they are in the overworld!

    notifyNeighborsOfStateChange: ((world, pos, fromTick, tick, forceNotify?, data?) => void)

    Similar to serv.updateBlock but will trigger an update on the 6 direct neighbors of pos but not on the block itself.

    Type declaration

      • (world, pos, fromTick, tick, forceNotify?, data?): void
      • Similar to serv.updateBlock but will trigger an update on the 6 direct neighbors of pos but not on the block itself.

        Parameters

        • world: any
        • pos: any
        • fromTick: any
        • tick: any
        • Optional forceNotify: boolean
        • Optional data: null

        Returns void

    notifyNeighborsOfStateChangeDirectional: ((world, pos, dir, fromTick, tick, forceNotify?, data?) => void)

    Similar to serv.updateBlock but will trigger an update on 5 of the direct neighbors of pos.plus(dir), but not on the block at pos or pos.plus(dir).

    Type declaration

      • (world, pos, dir, fromTick, tick, forceNotify?, data?): void
      • Similar to serv.updateBlock but will trigger an update on 5 of the direct neighbors of pos.plus(dir), but not on the block at pos or pos.plus(dir).

        Parameters

        • world: any
        • pos: any
        • dir: any
        • fromTick: any
        • tick: any
        • Optional forceNotify: boolean
        • Optional data: null

        Returns void

    onBlockInteraction: ((name, handler) => void)

    Register a handler that will be called when a player interact with a block of type name.

    The argument given to the handler is an object containing the clicked block and the player. It should return true if the block interaction occurred and the block placement should be cancelled.

    Type declaration

      • (name, handler): void
      • Register a handler that will be called when a player interact with a block of type name.

        The argument given to the handler is an object containing the clicked block and the player. It should return true if the block interaction occurred and the block placement should be cancelled.

        Parameters

        • name: any
        • handler: any

        Returns void

    onBlockUpdate: ((name, handler) => void)

    Register a handler that will be called when a block of the type name is updated. It should verify that the block state is still correct according to the game's rules. It is triggered when a neighboring block has been modified.

    The arguments of the handler are the world in which the update occurred, the block, fromTick the tick at which the update was triggered, the tick the update was scheduled to (current tick), and optional data (null most of the time) that can be used to transmit data between block updates. The handler should return true if the block was changed so the update manager can send a multiBlockChange packet for all the changes that occurred within the tick. The state of the block should be modified by using the world's setBlockXXX functions instead of serv.setBlock (that would send redundant updates to players).

    Type declaration

      • (name, handler): void
      • Register a handler that will be called when a block of the type name is updated. It should verify that the block state is still correct according to the game's rules. It is triggered when a neighboring block has been modified.

        The arguments of the handler are the world in which the update occurred, the block, fromTick the tick at which the update was triggered, the tick the update was scheduled to (current tick), and optional data (null most of the time) that can be used to transmit data between block updates. The handler should return true if the block was changed so the update manager can send a multiBlockChange packet for all the changes that occurred within the tick. The state of the block should be modified by using the world's setBlockXXX functions instead of serv.setBlock (that would send redundant updates to players).

        Parameters

        • name: any
        • handler: any

        Returns void

    onItemPlace: ((name, handler, warn?) => void)

    Register a handler that will be called when an item of type name is called to place a block.

    The argument given to the handler is an object containing the held item that triggered the event, the direction (face) on which the player clicked, the angle of the player around the placed block. It should return an object containing the id and data of the block to place.

    Type declaration

      • (name, handler, warn?): void
      • Register a handler that will be called when an item of type name is called to place a block.

        The argument given to the handler is an object containing the held item that triggered the event, the direction (face) on which the player clicked, the angle of the player around the placed block. It should return an object containing the id and data of the block to place.

        Parameters

        • name: any
        • handler: any
        • Optional warn: boolean

        Returns void

    overworld: CustomWorld

    Contains the overworld world. This is where the default spawn point is

    pardonUsername: ((username) => Promise<boolean>)

    Pardons a player given a username.

    Type declaration

      • (username): Promise<boolean>
      • Pardons a player given a username.

        Parameters

        • username: string

        Returns Promise<boolean>

    playNoteBlock: ((pitch, world, position, __namedParameters?) => void)

    Plays noteblock in world at position. pitch is from 0-24

    Type declaration

      • (pitch, world, position, __namedParameters?): void
      • Plays noteblock in world at position. pitch is from 0-24

        Parameters

        • pitch: any
        • world: any
        • position: any
        • Optional __namedParameters: {
              instrument?: string;
              particle?: boolean;
          }
          • Optional instrument?: string
          • Optional particle?: boolean

        Returns void

    playSound: ((sound, world, position, __namedParameters?) => void)

    Plays sound (string, google "minecraft sound list") to all players in opt.radius. If position is null, will play at the location of every player (taking into account whitelist and blacklist).

    Opt:

    • whitelist: Array of players that can hear the sound (can be a player object)
    • blacklist: Array of players who cannot hear the sound
    • radius: Radius that sound can be heard (in fixed position so remember to multiply by 32, default 32*32)
    • volume: float from 0-1 (default 1.0)
    • pitch: float from 0.5 to 2 (default 1.0)

    Type declaration

      • (sound, world, position, __namedParameters?): void
      • Plays sound (string, google "minecraft sound list") to all players in opt.radius. If position is null, will play at the location of every player (taking into account whitelist and blacklist).

        Opt:

        • whitelist: Array of players that can hear the sound (can be a player object)
        • blacklist: Array of players who cannot hear the sound
        • radius: Radius that sound can be heard (in fixed position so remember to multiply by 32, default 32*32)
        • volume: float from 0-1 (default 1.0)
        • pitch: float from 0.5 to 2 (default 1.0)

        Parameters

        • sound: any
        • world: any
        • position: any
        • Optional __namedParameters: {
              blacklist?: any[];
              pitch?: number;
              radius?: number;
              soundCategory?: number;
              volume?: number;
              whitelist?: any;
          }
          • Optional blacklist?: any[]
          • Optional pitch?: number
          • Optional radius?: number
          • Optional soundCategory?: number
          • Optional volume?: number
          • Optional whitelist?: any

        Returns void

    players: Player[]

    An array of players currently logged in

    plugins: {}

    List of all plugins. Use serv.plugins[pluginName] to get a plugin's object and data.

    Type declaration

      pluginsReady: boolean
      selectorString: ((str, pos?, world?, allowUser?, ctxEntityId?) => Entity[])

      Returns an array of entities that satisfies the given command selector string str, execution position pos, execution world world, and the ID of the entity that initiated the execution ctxEntityId.

      Valid selector string values are names of online players and valid target selector variables.

      Setting allowUser to true (default value) enables players to be included in the returned array, disables otherwise.

      Type declaration

        • (str, pos?, world?, allowUser?, ctxEntityId?): Entity[]
        • Returns an array of entities that satisfies the given command selector string str, execution position pos, execution world world, and the ID of the entity that initiated the execution ctxEntityId.

          Valid selector string values are names of online players and valid target selector variables.

          Setting allowUser to true (default value) enables players to be included in the returned array, disables otherwise.

          Parameters

          • str: string
          • Optional pos: Vec3
          • Optional world: any
          • Optional allowUser: boolean
          • Optional ctxEntityId: any

          Returns Entity[]

      setBlock: ((world, position, stateId) => Promise<void>)

      Saves block in world and sends block update to all players of the same world.

      Type declaration

        • (world, position, stateId): Promise<void>
        • Saves block in world and sends block update to all players of the same world.

          Parameters

          • world: CustomWorld
          • position: Vec3
          • stateId: number

          Returns Promise<void>

      setBlockAction: ((world, position, actionId, actionParam) => Promise<void>)

      Sends a block action to all players of the same world.

      Type declaration

        • (world, position, actionId, actionParam): Promise<void>
        • Sends a block action to all players of the same world.

          Parameters

          • world: CustomWorld
          • position: Vec3
          • actionId: number
          • actionParam: any

          Returns Promise<void>

      setTickInterval: ((ticksPerSecond) => void)

      Resets tick interval to occur ticksPerSecond times per second.

      Use stopTickInterval server.stopTickInterval() if you want but this method already calls that and you can use serv.doDaylightCycle to stop it anyway.

      Type declaration

        • (ticksPerSecond): void
        • Resets tick interval to occur ticksPerSecond times per second.

          Use stopTickInterval server.stopTickInterval() if you want but this method already calls that and you can use serv.doDaylightCycle to stop it anyway.

          Parameters

          • ticksPerSecond: any

          Returns void

      setTime: ((time) => void)

      Set daylight cycle time in ticks. See serv.time for more info.

      Type declaration

        • (time): void
        • Set daylight cycle time in ticks. See serv.time for more info.

          Parameters

          • time: any

          Returns void

      spawnPoint?: Vec3

      Global spawn and respawn point for every player

      supportFeature: ((feature) => boolean)

      Type declaration

        • (feature): boolean
        • Parameters

          • feature: string

          Returns boolean

      tabComplete: {
          add: ((id, cb) => void);
          types: any[];
          use: ((id, otherData?, existingContent?) => void);
      }

      serv.tabComplete has types and tab completition function

      You can provide your types:

      serv.tabComplete.add('tabId', () => {
      return ['some', 'values', 'in array', 'ONLY STRINGS!']
      })

      Type declaration

      • add: ((id, cb) => void)
          • (id, cb): void
          • Parameters

            • id: any
            • cb: any

            Returns void

      • types: any[]
      • use: ((id, otherData?, existingContent?) => void)
          • (id, otherData?, existingContent?): void
          • Parameters

            • id: any
            • Optional otherData: null
            • Optional existingContent: string

            Returns void

      tickCount: number

      Total number of ticks that have passed since the start of the world. Best to use with modulo (e.g. Something every 10 seconds is serv.tickCount % 20*10 === 0)

      time: number

      Current daylight cycle time in ticks. Morning is 0, noon is 6000, evening is 12000, and night is 18000. Resets to 0 at 24000. Use serv.setTime(time) to set the time.

      updateBlock: ((world, pos, fromTick, tick, forceNotify?, data?) => void)

      Trigger a block update for the block in world at pos. fromTick is the current server tick serv.tickCount, tick is the future server tick when the update should be executed. When forceNotify is true, the block update will always trigger an update on the 6 direct neighbors, even when no handler is registered for this block type. data is an optional object that will be given to the handler.

      Type declaration

        • (world, pos, fromTick, tick, forceNotify?, data?): void
        • Trigger a block update for the block in world at pos. fromTick is the current server tick serv.tickCount, tick is the future server tick when the update should be executed. When forceNotify is true, the block update will always trigger an update on the 6 direct neighbors, even when no handler is registered for this block type. data is an optional object that will be given to the handler.

          Parameters

          • world: any
          • pos: any
          • fromTick: any
          • tick: any
          • Optional forceNotify: boolean
          • Optional data: null

          Returns void

      uuidToPlayer: {}

      Object for converting UUIDs to players

      Type declaration

        warn: ((message) => void)

        Logs a message as warning

        Type declaration

          • (message): void
          • Logs a message as warning

            Parameters

            • message: any

            Returns void

        Methods

        • Type Parameters

          • E extends keyof ServerEvents

          Parameters

          • event: E
          • listener: ServerEvents[E]

          Returns this

        • Type Parameters

          • E extends keyof ServerEvents

          Parameters

          • event: E
          • Rest ...args: Arguments<ServerEvents[E]>

          Returns boolean

        • Returns (string | symbol)[]

        • Returns number

        • Type Parameters

          • E extends keyof ServerEvents

          Parameters

          • event: E

          Returns number

        • Type Parameters

          • E extends keyof ServerEvents

          Parameters

          • event: E

          Returns Function[]

        • Type Parameters

          • E extends keyof ServerEvents

          Parameters

          • event: E
          • listener: ServerEvents[E]

          Returns this

        • Type Parameters

          • E extends keyof ServerEvents

          Parameters

          • event: E
          • listener: ServerEvents[E]

          Returns this

        • Type Parameters

          • E extends keyof ServerEvents

          Parameters

          • event: E
          • listener: ServerEvents[E]

          Returns this

        • Type Parameters

          • E extends keyof ServerEvents

          Parameters

          • event: E
          • listener: ServerEvents[E]

          Returns this

        • Type Parameters

          • E extends keyof ServerEvents

          Parameters

          • event: E
          • listener: ServerEvents[E]

          Returns this

        • Type Parameters

          • E extends keyof ServerEvents

          Parameters

          • event: E

          Returns Function[]

        • Type Parameters

          • E extends keyof ServerEvents

          Parameters

          • Optional event: E

          Returns this

        • Type Parameters

          • E extends keyof ServerEvents

          Parameters

          • event: E
          • listener: ServerEvents[E]

          Returns this

        • Parameters

          • maxListeners: number

          Returns this

        Generated using TypeDoc