I cant add xp level code: PHP: <?phpnamespace core\Task;use pocketmine\scheduler\Task;use core\Main;use pocketmine\plugin\Plugin;use pocketmine\event\Listener;use pocketmine\entity\Human;class MainTask extends Task implements Listener { public function __construct(Main $plugin){ $this->plugin = $plugin; } public function onRun(int $currentTick){ foreach($this->plugin->getServer()->getOnlinePlayers() as $player){ $human = Human::class; $exp = $human->getXpLevel() + 1; $human->setXpLevel((int)$exp); $player->sendPopup("§e+§a1§bXp§r\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); } }}
The code you posted should be in PHP tags like so: Code: [PHP]code here[/PHP] , to make it properly readable to others. When I look at your code there's numerous errors. First of all, on the class declaration line: PHP: class MainTask extends Task implements Listener { Your task does not listen for events so remove the Listener implementation like so: PHP: class MainTask extends Task { Secondly, you're assigning a dynamic class property, which you might not want to do for the sake of readability. Add this right under your class declaration: PHP: private $plugin; Then for your actual issue, you're setting $human to Human::class, which is a string. ::class is a reserved 'constant' for classes which simply returns the path to the class. You already have a Human however, because Player extends Human. You can remove this line: PHP: $human = Human::class; And you can rename further usages of $human to $player. To improve your code further, you can look at this part: PHP: $exp = $player->getXpLevel() + 1;$player->setXpLevel((int)$exp); getXpLevel() already returns an integer, so you can simply remove the (int) cast, like so: PHP: $exp = $player->getXpLevel() + 1;$player->setXpLevel($exp);