UNPKG

observermc

Version:

A Node.js wrapper and API for multiple Minecraft Servers

55 lines (54 loc) 1.92 kB
import { ObserverOptions } from "./ObserverOptions"; import { MinecraftServer } from "../minecraft-server/MinecraftServer"; export declare class ObserverWrapper { private _options; private _servers; /** * Creates an instance of ObserverWrapper. * @param {ObserverOptions} [options] Observe Options. */ constructor(options: ObserverOptions); /** * Starts all servers. * @return {*} Promise that resolves to an object with the server names as key and if they started as value. */ start(): Promise<{ [serverName: string]: boolean; }>; /** * Starts a server. * @param {string} serverName Name of the server. * @return {Promise<boolean>} Promise that resolves to true if the server started. */ start(serverName: string): Promise<boolean>; /** * Sends a stop command to all servers. * @return {*} An object with the server names as key and if the command was sent as value. */ stop(): { [serverName: string]: boolean; }; /** * Sends a stop command to a server. * @param {string} serverName Name of the server. * @return {boolean} true if signal was sent. */ stop(serverName: string): boolean; /** * Get online players from all servers. * @return {*} An object with the server names as key and the server's online players names list as value. */ getOnlinePlayers(): { [serverName: string]: string[]; }; /** * Get online players from a server. * @param {string} serverName Name of the server. * @return {string[]} The server's online players names list. */ getOnlinePlayers(serverName: string): string[]; /** Gets an instance of a server. */ getServer(serverName: string): MinecraftServer; /** Servers name list */ get servers(): string[]; }