Fixed: Check cast

Instead of doing an unsafe cast, actually check if the HumanEntity supplied is a CraftHumanEntity. Plugins adding custom HumanEntities to the viewers of an inventory will end up crashing the server when the Chunk containing the block which contains the inventory unloads, since the original cast is unchecked here.

I'm not sure if there was a reason for casting to CraftHumanEntity, so I kept it, but HumanEntity, as I'm sure you know, has a closeInventory() method you could call instead of getting the CraftBukkit handle. There's probably a reason behind it, though.

I tried to follow the formatting conventions, but I may have missed something.

Tested the easily reproducible issue using this patch compiled, and it works fine; no crashes in sight.