PocketMine-MP 5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
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

const TICKS_PER_AUTOSAVE = 300 * Server::TARGET_TICKS_PER_SECOND
 

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 70 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 332 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

Exceptions

InvalidArgumentException

Definition at line 264 of file WorldManager.php.

◆ getAutoSave()

pocketmine\world\WorldManager::getAutoSave ( )

Definition at line 369 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 383 of file WorldManager.php.

◆ getDefaultWorld()

pocketmine\world\WorldManager::getDefaultWorld ( )

Definition at line 88 of file WorldManager.php.

◆ getProviderManager()

pocketmine\world\WorldManager::getProviderManager ( )

Definition at line 76 of file WorldManager.php.

◆ getWorld()

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

Definition at line 107 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 114 of file WorldManager.php.

◆ getWorlds()

pocketmine\world\WorldManager::getWorlds ( )
Returns
World[] @phpstan-return array<int, World>

Definition at line 84 of file WorldManager.php.

◆ isWorldGenerated()

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

Definition at line 316 of file WorldManager.php.

◆ isWorldLoaded()

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

Definition at line 103 of file WorldManager.php.

◆ loadWorld()

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

Loads a world from the data directory

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

Definition at line 174 of file WorldManager.php.

◆ setAutoSave()

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

Definition at line 373 of file WorldManager.php.

◆ setAutoSaveInterval()

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

Definition at line 387 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 97 of file WorldManager.php.

◆ tick()

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

Definition at line 343 of file WorldManager.php.

◆ unloadWorld()

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

InvalidArgumentException

Definition at line 127 of file WorldManager.php.

Member Data Documentation

◆ TICKS_PER_AUTOSAVE

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: