Hello there, i am making rpg server that use emerald as its currency but i have no idea how to check ammount of emeralds in player inventory so i can make scorehud addons. Pls help
PHP: /** @var pocketmine\Player $player*/$count = 0;foreach($player->getInventory()->getContents() as $item){ if($item->getId() === Item::EMERALD) $count += $item->getCount()}$player->sendMessage("§aYou have §l{$count} §r§aEmeralds !"); To make the thing show in scoreboard, in your addon instead of sending a message you could set your value to the $count variable