hello I used "getArmorInventory->setBoots" to put shoes on a player when they entered the server. Problem is, players who are already on it don't see these boots. Only the people who enter the server afterwards will see the boots of the respective player. The whole thing can be reproduced on with trousers, breastplates and helmets PHP: if($player->hasPermission("lobby.yt")){ /** @var Armor $lila */ $lila = Armor::get(Armor::LEATHER_BOOTS); $lila->setCustomColor(new \pocketmine\utils\Color(162, 0, 255)); $player->getArmorInventory()->setBoots($lila); } I hope you have some advice for me.
From what I tested a couple of weeks ago, PlayerJoinEvent isn't always or at all called when the player joins or is spawned in the server where he can move.
You may try using ArmorInventory::sendContents() or if it also doesn't work give the boots in a delayed task.
sendContents() wouldn't work because at the time PlayerJoinEvent gets called, other players still can't see the player so the player has 0 viewers. A delayed task would work, yeah. It no longer gets called on player joins anymore AFAIK. There were other events that would be unwantedly called on player joins that no longer do (eg: EntityArmorChangeEvent).
Try this code PHP: use pocketmine\item\Item;use pocketmine\utils\Color; PHP: if($player->hasPermission("lobby.yt")){ $armor = Item::get(Item::LEATHER_BOOTS); $color = new Color(0, 204, 0); $armor->setCustomColor($color); $player->getArmorInventory()->setBoots($armor);}
No, as @Muqsit already said, while entering you don't see the respective player so the viewers are equal to 0