Home - Thouvvv/PlayerDataManager GitHub Wiki
PlayerDataManager
PlayerDataManager is a PocketMine plugin that allows developers to store data in a central place throughout a server. This data comes in the form of properties (PDMProperty
) that are assigned to players (PDMPlayer
). Our flexible API lets any plugin access or set any player's properties.
PDM is an acronym for PlayerDataManager that is used throughout the API and this documentation
Getting started
You can get PDM's instance this way:
PlayerDataManager::getInstance();
The rest of the documentation will assume $pdm
to be the above and $player
to be an instance of \pocketmine\Player
.
Registering a player
$pdm->registerPlayer($player->getName());
The rest of the documentation will assume $pdm_player
to be the above, an instance of PDMPlayer
.
PlayerDataManager documentation
Setting properties
$pdm_player->setProperties([PDMPropertyFactory::makeProperty("property name", "property value")]);
$pdm_player->setProperties(PDMPropertyFactory::makeProperties(["last join" => time(), "money" => 810000000]));
[PDMPropertyFactory documentation]
Fetching properties
$property = $pdm_player->getProperty("property name");
echo $property->getPropertyName() . " ::: " . $property->getValue();
// property name ::: property value
These are the very basic features of this plugin, check out each class's documentation to learn about MySQL synchronization, property flags, conditional fetching of properties, and more!
[PDMPropertyFactory]
[utils\PropertyUtils]
[provider\PDMProvider]
[Configuration]