PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
pocketmine\world\WorldManager Class Reference
+ Collaboration diagram for pocketmine\world\WorldManager:

Public Member Functions

 __construct (private Server $server, private string $dataPath, private WorldProviderManager $providerManager)
 findEntity (int $entityId)
 generateWorld (string $name, WorldCreationOptions $options, bool $backgroundGeneration=true)
 getAutoSave ()
 getAutoSaveInterval ()
 getDefaultWorld ()
 getProviderManager ()
 getWorld (int $worldId)
 getWorldByName (string $name)
 getWorlds ()
 isWorldGenerated (string $name)
 isWorldLoaded (string $name)
 loadWorld (string $name, bool $autoUpgrade=false)
 setAutoSave (bool $value)
 setAutoSaveInterval (int $autoSaveTicks)
 setDefaultWorld (?World $world)
 tick (int $currentTick)
 unloadWorld (World $world, bool $forceUnload=false)

Public Attributes


Detailed Description

Definition at line 56 of file WorldManager.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\world\WorldManager::__construct ( private Server  $server,
private string  $dataPath,
private WorldProviderManager  $providerManager 

Definition at line 67 of file WorldManager.php.

Member Function Documentation

◆ findEntity()

pocketmine\world\WorldManager::findEntity ( int  $entityId)

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

Definition at line 328 of file WorldManager.php.

◆ generateWorld()

pocketmine\world\WorldManager::generateWorld ( string  $name,
WorldCreationOptions  $options,
bool  $backgroundGeneration = true 

Generates a new world if it does not exist



Definition at line 260 of file WorldManager.php.

◆ getAutoSave()

pocketmine\world\WorldManager::getAutoSave ( )

Definition at line 365 of file WorldManager.php.

◆ getAutoSaveInterval()

pocketmine\world\WorldManager::getAutoSaveInterval ( )

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

Definition at line 379 of file WorldManager.php.

◆ getDefaultWorld()

pocketmine\world\WorldManager::getDefaultWorld ( )

Definition at line 84 of file WorldManager.php.

◆ getProviderManager()

pocketmine\world\WorldManager::getProviderManager ( )

Definition at line 73 of file WorldManager.php.

◆ getWorld()

pocketmine\world\WorldManager::getWorld ( int  $worldId)

Definition at line 103 of file WorldManager.php.

◆ getWorldByName()

pocketmine\world\WorldManager::getWorldByName ( string  $name)

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

Definition at line 110 of file WorldManager.php.

◆ getWorlds()

pocketmine\world\WorldManager::getWorlds ( )

Definition at line 80 of file WorldManager.php.

◆ isWorldGenerated()

pocketmine\world\WorldManager::isWorldGenerated ( string  $name)

Definition at line 312 of file WorldManager.php.

◆ isWorldLoaded()

pocketmine\world\WorldManager::isWorldLoaded ( string  $name)

Definition at line 99 of file WorldManager.php.

◆ loadWorld()

pocketmine\world\WorldManager::loadWorld ( string  $name,
bool  $autoUpgrade = false 

Loads a world from the data directory

bool$autoUpgradeConverts worlds to the default format if the world's format is not writable / deprecated

Definition at line 170 of file WorldManager.php.

◆ setAutoSave()

pocketmine\world\WorldManager::setAutoSave ( bool  $value)

Definition at line 369 of file WorldManager.php.

◆ setAutoSaveInterval()

pocketmine\world\WorldManager::setAutoSaveInterval ( int  $autoSaveTicks)

Definition at line 383 of file WorldManager.php.

◆ setDefaultWorld()

pocketmine\world\WorldManager::setDefaultWorld ( ?World  $world)

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

Definition at line 93 of file WorldManager.php.

◆ tick()

pocketmine\world\WorldManager::tick ( int  $currentTick)

Definition at line 339 of file WorldManager.php.

◆ unloadWorld()

pocketmine\world\WorldManager::unloadWorld ( World  $world,
bool  $forceUnload = false 


Definition at line 123 of file WorldManager.php.

Member Data Documentation


const pocketmine\world\WorldManager::TICKS_PER_AUTOSAVE = 300 * Server::TARGET_TICKS_PER_SECOND

Definition at line 57 of file WorldManager.php.

The documentation for this class was generated from the following file: