Bukkit/CraftBukkit — pull request #1176 by millerkil (2013-06-12 15:24:21+00:00)
Title: [C] Close the chest if the event was cancelled. Fixes BUKKIT-1440

#### The Issue

If a ```InventoryOpenEvent``` is cancelled for a chest, the chest will open and remain open until the chunk reloads. This is because the constructor for ```ContainerChest``` opens the chest, and this class is used by the event.

#### Justification for PR

Cancelling an event should not cause a break like this. The expected behaviour when cancelling the ```InventoryOpenEvent``` is that the chest does not open.

#### PR Breakdown

If the event was cancelled, we will close the chest before returning.

### Additional Notes

Although this is not the ideal solution because the server still simulates the opening and closing of the chest, it does fix the bug in question and it is a simple one liner, where a full solution would require too much changes to MC classes.

An issue with mechanics this does not fix is that a trapped chest will still provide a tick of redstone, which is enough if you have TNT under the chest.

#### JIRA Ticket

BUKKIT-1440 - https://bukkit.atlassian.net/browse/BUKKIT-1440