Bukkit/CraftBukkit — pull request #1095 by TriPhoenix (2013-03-24 16:26:19+00:00)
Title: [C] Fix crash when cancelling hopper minecart events. Fixes BUKKIT-3883

**The Issue:**
A bug in TileEntityHopper.java results in a server crash, when an InventoryMoveItemEvent involving a hopper minecart retrieving items from another container is being cancelled. This comes from the fact that hopper minecarts are being treated as hopper tile entities when it comes to the "re-fire" timer. TileEntitityHopper.tryTakeInItemFromSlot does not handle hopper minecarts correctly when events are being cancelled.

**Justification for this PR:**
Obviously the crash needs to be fixed. The code should still issue the normal hopper delay of 8 ticks when cancelling events to avoid excessive event spam (otherwise hoppers would re-issue the same event every tick) but needs to differentiate between the two types of hoppers.

**PR Breakdown:**
This patch does the appropriate checks and uses the correct delay methods for
TileEntityHopper and EntityMinecartHopper.

**Testing Results and Materials:**
A simple plugin that can be used to provoke the crash and test this patch can be found at https://gist.github.com/TriPhoenix/5232534
It simply blocks all dirt movement by hoppers and will result in a crash when the dirt is being pulled by a hopper minecart.

**Relevant PR(s):**
None

**JIRA Ticket:**
BUKKIT-3883 - https://bukkit.atlassian.net/browse/BUKKIT-3883