Skip to content

WorldManager ​

class · pocketmine\world\WorldManager · source

Constants ​

TICKS_PER_AUTOSAVE ​

php
public const TICKS_PER_AUTOSAVE = 300 * \pocketmine\Server::TARGET_TICKS_PER_SECOND

Methods ​

__construct() ​

php
public function __construct(\pocketmine\Server $server, string $dataPath, \pocketmine\world\format\io\WorldProviderManager $providerManager)

areDimensionsEnabled() 5.46.0 ​

php
public function areDimensionsEnabled() : bool

Whether Nether and End worlds linked to Overworld worlds may be generated automatically (pocketmine.yml dimensions.enabled).

findEntity() ​

php
public function findEntity(int $entityId) : ?\pocketmine\entity\Entity

Searches all worlds for the entity with the specified ID. Useful for tracking entities across multiple worlds without needing strong references.

generateWorld() ​

php
public function generateWorld(string $name, \pocketmine\world\WorldCreationOptions $options, bool $backgroundGeneration = true) : bool

Generates a new world if it does not exist

getAutoSave() ​

php
public function getAutoSave() : bool

getAutoSaveInterval() ​

php
public function getAutoSaveInterval() : int

Returns the period in ticks after which loaded worlds will be automatically saved to disk.

getDefaultWorld() ​

php
public function getDefaultWorld() : ?\pocketmine\world\World

getLinkedWorld() 5.46.0 ​

php
public function getLinkedWorld(\pocketmine\world\World $world, \pocketmine\world\dimension\Dimension $target) : ?\pocketmine\world\World

Returns the world of the target dimension linked to the given world (see getLinkedWorldName()), loading it if needed. If it doesn't exist and dimensions are enabled, it is generated with the seed of the given world. Returns null if there is no such world.

getLinkedWorldName() 5.46.0 ​

php
public static function getLinkedWorldName(string $worldName, \pocketmine\world\dimension\Dimension $worldDimension, \pocketmine\world\dimension\Dimension $target) : string

Returns the name of the world of the target dimension linked to the given world. Worlds are linked by name like on the vanilla Java server: "world" (Overworld), "world_nether" (Nether) and "world_the_end" (End).

getProviderManager() ​

php
public function getProviderManager() : \pocketmine\world\format\io\WorldProviderManager

getWorld() ​

php
public function getWorld(int $worldId) : ?\pocketmine\world\World

getWorldByName() ​

php
public function getWorldByName(string $name) : ?\pocketmine\world\World

NOTE: This matches worlds based on the FOLDER name, NOT the display name.

getWorlds() ​

php
public function getWorlds() : array

isWorldGenerated() ​

php
public function isWorldGenerated(string $name) : bool

isWorldLoaded() ​

php
public function isWorldLoaded(string $name) : bool

loadWorld() ​

php
public function loadWorld(string $name, bool $autoUpgrade = false) : bool

Loads a world from the data directory

setAutoSave() ​

php
public function setAutoSave(bool $value) : void

setAutoSaveInterval() ​

php
public function setAutoSaveInterval(int $autoSaveTicks) : void

setDefaultWorld() ​

php
public function setDefaultWorld(?\pocketmine\world\World $world) : void

Sets the default world to a different world This won't change the level-name property, it only affects the server on runtime

setDimensionsEnabled() 5.46.0 ​

php
public function setDimensionsEnabled(bool $enabled) : void

setWorldDimension() 5.46.0 ​

php
public function setWorldDimension(string $name, ?\pocketmine\world\dimension\Dimension $dimension) : void

Sets the dimension a world will be presented as when it is next loaded or generated, overriding the dimension of its generator. Null removes the override. Has no effect on worlds that are already loaded.

tick() ​

php
public function tick(int $currentTick) : void

unloadWorld() ​

php
public function unloadWorld(\pocketmine\world\World $world, bool $forceUnload = false) : bool

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.