Bukkit/CraftBukkit — pull request #1332 by Aaron1011 (2014-02-02 21:23:12+00:00)
Title: [B+C] Adds the getSlot method to BlockDispenseEvent. Fixes BUKKIT-5142

#### The Issue:

Currently, there is no way to get which slot of a dispense/dropper was used from a `BlockDispenseEvent`. This makes it impossible for rollback plugins from determining how to reset a dispenser/dropper's inventory.

#### Justification for this PR:

Adding the getSlot method allows plugin developers to detect which slot was used for dispensing an item. This can be used in a, for example, an antigrief/rollback plugin, which stores the slot used, and later adds the appropriate item to it.

#### PR Breakdown:

In all of the `DispenseBehavior` classes, I've changed the method signatures of `a` and `b` to add a `slot` parameter. This is passed into the constructor for `BlockDispenseEvent`. The internal variable 'l' is used in `BlockDispenser` and `BlockDropper` for `slot`, as it's the random number used for determining the slot to use.

#### Testing Results and Materials:

I've created a plugin called [SlotTester](https://www.dropbox.com/s/7i7k0urp5881bl7/SlotTester.jar). To use it, compile the CraftBukkit in the PR against my Bukkit PR listed in the Relevant PRs section. Load the plugin, then load and fire a dispenser of hopper. You will see "Slot: #" printed in the chat, where "#" is the number of the slot used, from 0 to 8. The source code can be viewed [here](https://github.com/Aaron1011/SlotTester).

#### Relevant PR(s):

B-

#### JIRA Ticket:

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