From c715efb18e44c11a96409fcd6e9fd6e4064f140d Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 3 Jun 2023 21:22:26 +0100 Subject: [PATCH] Jukebox: fix music not stopping when destroyed by explosion closes #5794 --- src/block/tile/Jukebox.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/block/tile/Jukebox.php b/src/block/tile/Jukebox.php index 3154c6a07..4d5bfdbb8 100644 --- a/src/block/tile/Jukebox.php +++ b/src/block/tile/Jukebox.php @@ -26,6 +26,7 @@ namespace pocketmine\block\tile; use pocketmine\item\Item; use pocketmine\item\Record; use pocketmine\nbt\tag\CompoundTag; +use pocketmine\world\sound\RecordStopSound; class Jukebox extends Spawnable{ private const TAG_RECORD = "RecordItem"; //Item CompoundTag @@ -61,4 +62,8 @@ class Jukebox extends Spawnable{ $nbt->setTag(self::TAG_RECORD, $this->record->nbtSerialize()); } } + + protected function onBlockDestroyedHook() : void{ + $this->position->getWorld()->addSound($this->position, new RecordStopSound()); + } }