@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
    public void onDropLockedItemOnDeath(PlayerDeathEvent event) {
        if (event.getEntity().getWorld().isGameRule("keepInventory")) {
            return;
        }
        final Player player = event.getEntity();
        if (player.hasPermission("disable.slot.locking")) {
            return;
        }
        List<ItemStack> drops = event.getDrops();
        drops.clear();
        PlayerInventory inv = player.getInventory();
        final Map<Integer, ItemStack> toKeep = new TreeMap<>();
        for (int index = 0; index < 40; index++) {
            if (player.hasPermission("cyom.slot.lock." + index)) {
                toKeep.put(index, inv.getItem(index));
            } else {
                drops.add(inv.getItem(index));
            }
        }
        if (!toKeep.isEmpty()) {
            new BukkitRunnable() {
                @Override
                public void run() {
                    PlayerInventory inv = player.getInventory();
                    for (Map.Entry<Integer, ItemStack> entry : toKeep.entrySet()) {
                        inv.setItem(entry.getKey(), entry.getValue());
                    }
                }
            }.runTask(plugin);
        }
    }