MapDataStore 5.46.0
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() : intReturns 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() : stringload()
php
public function load(int $id) : ?\pocketmine\world\map\MapDataLoads 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) : voidwasAllocated()
php
public function wasAllocated(int $id) : boolReturns whether the ID was handed out by allocateId() at some point.
