It seems that having chest inventory above 27 size will cause item duplication. It looks like items have been shifted from main inventory to custom one starting from 4th line.
Bukkit.getPlayer("Zrips").openInventory(Bukkit.createInventory(null, 54, "Test"));
Original players inventory
Some what related to issue #4718
SPIGOT-4718 Can not create Inventory with an custom size