pmmp / PocketMine-MP

A server software for Minecraft: Bedrock Edition in PHP
https://pmmp.io
GNU Lesser General Public License v3.0
3.28k stars 1.56k forks source link

Inventory Syncing Bug #6206

Closed odavidu closed 10 months ago

odavidu commented 10 months ago

Issue description

Steps to reproduce the issue

  1. Have at least one item in your invewntory
  2. Manually call Player->getNetworkSession()->getInvManager()->requestSyncAll() when a player joins
  3. See your item flicker in your inventory

OS and versions

Plugins

image

Crashdump, backtrace or other files

<?php
declare(strict_types=1);

namespace issue;

use pocketmine\event\Listener;
use pocketmine\event\player\PlayerJoinEvent;
use pocketmine\plugin\PluginBase;

class Issue extends PluginBase implements Listener {

    protected function onEnable(): void {
        $this->getServer()->getPluginManager()->registerEvents($this, $this);
    }

    public function onPlayerJoin(PlayerJoinEvent $event) {
        $player = $event->getPlayer();
        $player->getNetworkSession()->getInvManager()->requestSyncAll();
    }
}

image

dktapps commented 10 months ago

That function isn't supposed to be used by plugins anyway...