From 8408de02d23c35d67f5173db9d60aab488e60d9f Mon Sep 17 00:00:00 2001 From: jameslfc19 Date: Thu, 27 Aug 2020 11:16:27 +1000 Subject: [PATCH] #716: Fix barrel open API playing sound twice --- .../java/org/bukkit/craftbukkit/block/CraftBarrel.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java index b6b87cfdf9..c9d9469086 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.block; +import net.minecraft.server.BlockBarrel; import net.minecraft.server.IBlockData; import net.minecraft.server.SoundEffects; import net.minecraft.server.TileEntityBarrel; @@ -38,8 +39,12 @@ public class CraftBarrel extends CraftLootable implements Barr requirePlaced(); if (!getTileEntity().opened) { IBlockData blockData = getTileEntity().getBlock(); - getTileEntity().setOpenFlag(blockData, true); - getTileEntity().playOpenSound(blockData, SoundEffects.BLOCK_BARREL_OPEN); + boolean open = blockData.get(BlockBarrel.b); + + if (!open) { + getTileEntity().setOpenFlag(blockData, true); + getTileEntity().playOpenSound(blockData, SoundEffects.BLOCK_BARREL_OPEN); + } } getTileEntity().opened = true; }