Bukkit/CraftBukkit — pull request #566 by Evenprime (2011-12-02 19:44:54+00:00)
Title: Close inventories before teleporting players

As many people have noticed since 1.8.1 Minecraft, if a player gets teleported away from a workbench or any other place that can only hold items while the inventory screen is open (crafting area of the player inventory works too), a set of fake, duplicate items is dropped at that location, alongside a set of real items at the players target location.

While the duplicates are normally not usable (can't be picked up), their existance is clearly a mistake. Also, this trick may be used to smuggle items from one world into an other, because technically they are never in the players inventory, yet still get teleported with the player to his target location, where they lie on the ground and can be picked up afterwards.

This patch will simply close all inventory screens before the player is moved by teleportations, causing the items to fall to the ground where the player currently stands (like they did in MC 1.7 and earlier), and the player to get teleported without the items.