pmmp / PocketMine-MP

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

Teleporting 2 players to another world causes the players to become frozen on their client #5822

Closed AkmalFairuz closed 1 year ago

AkmalFairuz commented 1 year ago

Issue description

Teleporting 2 players to another world causes the players to become frozen on their client. See https://www.youtube.com/watch?v=NpACT6F8bck

In my opinion, this issue is caused when calling despawnFrom and spawnTo simultaneously (i think this related to https://github.com/pmmp/PocketMine-MP/issues/5810)

Steps to reproduce the issue

  1. Create 2 worlds.
  2. Simultaneously teleport 2 players to the other world.
  3. Move another player, on your client side the player appears frozen, but actually the player is moving.

OS and versions

Plugins

(Type "tp" on the chat to teleport all players to another world)

<?php

declare(strict_types=1);

namespace bug;

use pocketmine\event\Listener;
use pocketmine\event\player\PlayerChatEvent;
use pocketmine\plugin\PluginBase;
use pocketmine\Server;

class Main extends PluginBase implements Listener{

    const DEFAULT_WORLD_NAME = "world";
    const TARGET_WORLD_NAME = "target";

    protected function onEnable(): void{
        $this->getServer()->getPluginManager()->registerEvents($this, $this);
        Server::getInstance()->getWorldManager()->loadWorld(self::DEFAULT_WORLD_NAME);
        Server::getInstance()->getWorldManager()->loadWorld(self::TARGET_WORLD_NAME);
    }

    /**
     * @param PlayerChatEvent $event
     * @priority NORMAL
     */
    public function onChat(PlayerChatEvent $event): void{
        if($event->getMessage() === "tp") {
            foreach(Server::getInstance()->getOnlinePlayers() as $player) {
                $player->teleport(Server::getInstance()->getWorldManager()->getWorldByName($player->getWorld()->getFolderName() === self::TARGET_WORLD_NAME ? self::DEFAULT_WORLD_NAME : self::TARGET_WORLD_NAME)->getSpawnLocation());
                $event->getPlayer()->sendMessage("Teleported {$player->getName()}!");
            }
            $event->cancel();
        }
    }
}
dktapps commented 1 year ago

Yes, it would make sense that the same underlying client bug is responsible.

dktapps commented 1 year ago

Sadly I don't see any clear solution for this problem. If anyone in the community has ideas how to fix this, I'd love to hear them.

TristanKanner commented 1 year ago

I can’t play on my favorite server because of this bug, so this means a lot to mean if it’s fixed ASAP. So please make this a high priority

dktapps commented 1 year ago

Word is that this will be fixed in 1.20.10. Since there is no practical workaround for this on the server side, I'm going to close this.

TristanKanner commented 1 year ago

I don’t think 1.20.10 will be released as 1.20.1 was and now there is a better for 1.20.20 (an update after 1.20.10)

If you have words from Mojang developers that contradicts with my point then please tell me the estimated release date of this update.

TristanKanner commented 1 year ago

I don’t think 1.20.10 will be released as 1.20.1 was and now there is a better for 1.20.20 (an update after 1.20.10)

If you have words from Mojang developers that contradicts with my point then please tell me the estimated release date of this update.

If it’s not confirmed by Mojang please take my word and re-open this and attempt to fix it, this bug has a big impact on my life

dktapps commented 1 year ago

I don’t think 1.20.10 will be released as 1.20.1 was and now there is a better for 1.20.20 (an update after 1.20.10)

If you have words from Mojang developers that contradicts with my point then please tell me the estimated release date of this update.

Sure, why don't I break my NDA to convince a random nobody that his unsubstantiated assertions are complete nonsense?