PHP: <?phpnamespace Flsmers;use pocketmine\plugin\PluginBase as P;use pocketmine\event\Listener as L;use pocketmine\utils\TextFormat;use pocketmine\utils\MainLogger;use pocketmine\event\block\BlockBreakEvent as BBL;use pocketmine\level\sound\PopSound as Pop;use pocketmine\level\particle\ExplodeParticle as Explode;use pocketmine\block\Block;use pocketmine\math\Vector3;use pocketmine\item\Item;class Main extends P implements L{ public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this,$this); $this->saveDefaultConfig(); $this->getServer()->getLogger()->info(TextFormat::GREEN."[DropInStone] Włączony!"); } public function onBreak(BBL $e){ if($e->getBlock()->getId() == 1 && mt_rand(0,$this->getConfig()->get("t1-chance")) == "1"){ $p = $e->getPlayer(); $p->getLevel()->addParticle(new Explode($e->getBlock(), 2)); $p->getLevel()->addParticle(new Explode($e->getBlock(), 2)); $p->getLevel()->addParticle(new Explode($e->getBlock(), 2)); $p->sendMessage("§a • Wydropiłeś z stone'a - Coal • "); foreach($this->getConfig()->get("t1-loot") as $loot){ $p->getInventory()->addItem(Item::get($loot,0,mt_rand(1,$this->getConfig()->get("t1-item-max")))); } } else{ } How to add exp Stone's break and get 0.2 exp?
PocketMine does not have an experience API as far as I am aware. So you will have to handle it via direct packets to the players.
Yes it does: https://github.com/PocketMine/PocketMine-MP/blob/master/src/pocketmine/entity/Attribute.php To change experience: PHP: $player->getAttributeMap()->getAttribute(pocketmine\entity\Attribute::EXPERIENCE)->setValue($value); To change experience level: PHP: $player->getAttributeMap()->getAttribute(pocketmine\entity\Attribute::EXPERIENCE_LEVEL)->setValue($value);
Why :sob: https://github.com/PocketMine/PocketMine-MP/blob/master/src/pocketmine/entity/Human.php#L217 https://github.com/PocketMine/PocketMine-MP/blob/master/src/pocketmine/entity/Human.php#L225