Bukkit/CraftBukkit — pull request #1164 by Chipmunk9998 (2013-05-23 08:34:40+00:00)
Title: Check if location is in the same chunk before closing inventory.

Around three months ago, there was a pull request that made it so inventories opened with player.openInventory() would close when the player was teleported, found here:

https://github.com/Bukkit/CraftBukkit/pull/1025

The exploit happened when a player was teleported away from the location with an inventory open, if the chunk unloaded it would duplicate the items.

This has majorly conflicted with my plugin, because the player may sometimes get teleported a small distance after having an inventory opened for them.

This change simply makes it check if the teleportation was within the same chunk before teleporting, and if it is, it does not close their inventory.