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

Dragon Egg is not destroyed #4179

Closed alvin0319 closed 3 years ago

alvin0319 commented 3 years ago

Issue description

Vanilla behavior

https://user-images.githubusercontent.com/32565818/115112786-26e5d380-9fc2-11eb-94e1-76fe58269c62.mp4

PMMP behavior

https://user-images.githubusercontent.com/32565818/115112807-32d19580-9fc2-11eb-96dc-ddd7e057ea50.mp4

Steps to reproduce the issue

  1. Place Dragon Egg
  2. Try to destroy Dragon Egg

OS and versions

Plugins

Crashdump, backtrace or other files

Mohagames205 commented 3 years ago

Yeah that's because pocketmine doesn't check what gamemode the player is in. So, the exact behavior should be

Creative:

https://github.com/pmmp/PocketMine-MP/blob/master/src/block/DragonEgg.php#L59-L62

public function onAttack(Item $item, int $face, ?Player $player = null) : bool{
        $this->teleport();
        return true;
}