UNPKG

@jsprismarine/prismarine

Version:

Dedicated Minecraft Bedrock Edition server written in TypeScript

83 lines 2.4 kB
import { Server, Service } from '../'; import { GeneratorManager } from './'; import { World } from './World'; import { default as Provider } from './providers/Provider'; /** * Standard world data. */ export interface WorldData { seed: number; provider?: string; generator?: string; } /** * The world manager is responsible level loading, unloading, and general level management. */ export default class WorldManager implements Service { private readonly worlds; private defaultWorld; private readonly genManager; private readonly server; private providers; constructor(server: Server); /** * On enable hook, enables the manager and load all worlds. * @group Lifecycle */ enable(): Promise<void>; /** * On disable hook. * * Signifies that the manager is being disabled and all worlds should be unloaded. * @group Lifecycle */ disable(): Promise<void>; /** * Add a provider to the internal providers map. * * @param name - the name of the provider CASE SENSITIVE * @param provider - the provider */ addProvider(name: string, provider: any): void; /** * Remove a provider from the internal providers map. * * @param name - the name of the provider CASE SENSITIVE */ removeProvider(name: string): void; /** * Get all providers. */ getProviders(): Map<string, Provider>; /** * Save the world to disk. */ save(): Promise<void>; /** * Load a world * * @param worldData - the world data including provider key, generator * @param folderName - the name of the folder containing the world */ loadWorld(worldData: WorldData, folderName: string): Promise<World>; /** * Unloads a level by its folder name. */ unloadWorld(folderName: string): Promise<void>; /** * Returns whatever the world is loaded or not. * @returns {boolean} true if the world is loaded, false otherwise */ isWorldLoaded(folderName: string): boolean; /** * Returns a world by its folder name. */ getWorldByName(folderName: string): World | null; /** * Returns an array with all worlds. */ getWorlds(): World[]; getDefaultWorld(): World | undefined; getGeneratorManager(): GeneratorManager; } //# sourceMappingURL=WorldManager.d.ts.map