Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play sounds on door open/close #360

Merged
merged 2 commits into from
Jul 7, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/main/java/com/griefcraft/modules/doors/DoorsModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.griefcraft.scripting.JavaModule;
import com.griefcraft.scripting.event.LWCProtectionInteractEvent;
import com.griefcraft.util.config.Configuration;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
Expand Down Expand Up @@ -191,8 +192,11 @@ private void changeDoorStates(boolean allowDoorToOpen, Block... doors) {
// Get the top half of the door
Block topHalf = door.getRelative(BlockFace.UP);

// Now xor both data values with 0x8, the flag that states if the door is open
// Now xor both data values with 0x4, the flag that states if the door is open
door.setData((byte) (door.getData() ^ 0x4));

// Play the door open/close sound
door.getWorld().playEffect(door.getLocation(), Effect.DOOR_TOGGLE, 0);

// Only change the block above it if it is something we can open or close
if (isValid(topHalf.getType())) {
Expand Down