Skip to content

MapDataStore 5.46.0 ​

final class · pocketmine\world\map\MapDataStore · source

Saves map data in a folder: one gzip-compressed NBT file per map (map_<id>.dat, vanilla map data tags) and the next free map ID in idcounts.json. Vanilla Bedrock keeps maps in the world LevelDB as map_<id> keys; PocketMine keeps one folder for the whole server (<data>/maps), like PositionTrackingDB, so a map item keeps working in every world.

Methods ​

__construct() ​

php
public function __construct(string $path)

allocateId() ​

php
public function allocateId() : int

Returns a new map ID and saves the counter immediately, so that IDs are never handed out twice even if the server crashes.

getPath() ​

php
public function getPath() : string

load() ​

php
public function load(int $id) : ?\pocketmine\world\map\MapData

Loads the data of a map, or returns null if there is none (or it is corrupted).

save() ​

php
public function save(\pocketmine\world\map\MapData $data) : void

wasAllocated() ​

php
public function wasAllocated(int $id) : bool

Returns whether the ID was handed out by allocateId() at some point.

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