EcoCityCraft/Spigot-Server — pull request #56 by Hidendra (2013-04-09 21:21:58+00:00)
Title: [B+C] InventoryClickEvent now can return if the click was a double click

Hi,

I am sending this PR to you guys at the same time as CraftBukkit on advice of andrewkm. I hear you guys like to fix annoying bugs in a reasonable amount of time.

**The Issue:**

A new feature was added in Minecraft 1.5 that allows you to double click inside of an inventory while you have an item on the cursor. When you double click it will stack all like-items (same type as your cursor) from the container onto your cursor.

The current API provides no way to distinguish this from a normal inventory interaction event. This circumvents normal ways to block usage of an inventory because you can simply get an item that is inside of the inventory already and then double click yours and it will bring all of the ones in the inventory onto your cursor.

**Justification for this PR:**

Plugins that want to prevent a player from using an inventory (e.g. looking at it but not removing/placing items) are made useless because any item can be removed if you have the same item type that you wish to remove.

**PR Breakdown:**

It amends `InventoryClickEvent` by exposing the double click state that is only known internally

**Testing Results and Materials:**

LWC, a single-block protection plugin, has a feature which allows you to create a "donation" chest. This allows you to place items into the chest but not take items out.

Before this PR anyone could arbitrarily take items out of the donation chests by using their own item and double clicking it to gather up the ones inside of the chest.

I have fully tested the PR with LWC by implementing `isDoubleClick()`. This can be seen in [LWC/e5e7ae1c7](https://github.com/Hidendra/LWC/commit/e5e7ae1c77dd30cdd6a17b7ddee9c027fb746061) and a working build can be found [here](http://ci.griefcraft.com/job/LWC/865/)

**JIRA Ticket:**

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