WorldManager
Constants
TICKS_PER_AUTOSAVE
public const TICKS_PER_AUTOSAVE = 300 * \pocketmine\Server::TARGET_TICKS_PER_SECONDMethods
__construct()
public function __construct(\pocketmine\Server $server, string $dataPath, \pocketmine\world\format\io\WorldProviderManager $providerManager)areDimensionsEnabled() 5.46.0
public function areDimensionsEnabled() : boolWhether Nether and End worlds linked to Overworld worlds may be generated automatically (pocketmine.yml dimensions.enabled).
findEntity()
public function findEntity(int $entityId) : ?\pocketmine\entity\EntitySearches all worlds for the entity with the specified ID. Useful for tracking entities across multiple worlds without needing strong references.
generateWorld()
public function generateWorld(string $name, \pocketmine\world\WorldCreationOptions $options, bool $backgroundGeneration = true) : boolGenerates a new world if it does not exist
getAutoSave()
public function getAutoSave() : boolgetAutoSaveInterval()
public function getAutoSaveInterval() : intReturns the period in ticks after which loaded worlds will be automatically saved to disk.
getDefaultWorld()
public function getDefaultWorld() : ?\pocketmine\world\WorldgetLinkedWorld() 5.46.0
public function getLinkedWorld(\pocketmine\world\World $world, \pocketmine\world\dimension\Dimension $target) : ?\pocketmine\world\WorldReturns 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
public static function getLinkedWorldName(string $worldName, \pocketmine\world\dimension\Dimension $worldDimension, \pocketmine\world\dimension\Dimension $target) : stringReturns 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()
public function getProviderManager() : \pocketmine\world\format\io\WorldProviderManagergetWorld()
public function getWorld(int $worldId) : ?\pocketmine\world\WorldgetWorldByName()
public function getWorldByName(string $name) : ?\pocketmine\world\WorldNOTE: This matches worlds based on the FOLDER name, NOT the display name.
getWorlds()
public function getWorlds() : arrayisWorldGenerated()
public function isWorldGenerated(string $name) : boolisWorldLoaded()
public function isWorldLoaded(string $name) : boolloadWorld()
public function loadWorld(string $name, bool $autoUpgrade = false) : boolLoads a world from the data directory
setAutoSave()
public function setAutoSave(bool $value) : voidsetAutoSaveInterval()
public function setAutoSaveInterval(int $autoSaveTicks) : voidsetDefaultWorld()
public function setDefaultWorld(?\pocketmine\world\World $world) : voidSets 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
public function setDimensionsEnabled(bool $enabled) : voidsetWorldDimension() 5.46.0
public function setWorldDimension(string $name, ?\pocketmine\world\dimension\Dimension $dimension) : voidSets 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()
public function tick(int $currentTick) : voidunloadWorld()
public function unloadWorld(\pocketmine\world\World $world, bool $forceUnload = false) : bool