Inventory not updating on item pickup

I am using paper-api 1.15.2 R0.1 SNAPSHOT
When im opening an inventory from a playerJoinEvent (maybe any method I didn’t check) and close it not from the method that called it, when picking up an item later the item is picked up but the inventory isn’t updated.
opening the inventory: https://sourceb.in/18fa359a1e
the inventory holder class: https://sourceb.in/77e2021221
the menu interface that the inventory holder class implements:

public interface Menu extends InventoryHolder {
    default boolean onClick(Player player, int slot, ClickType type) { return true; }
    default void onOpen(Player player) {}
    default void onClose(Player player, Reason reason) {}
}

the listener for the inventory holder:

public class GuiListener implements Listener {
	@EventHandler(ignoreCancelled = false, priority = EventPriority.LOWEST)
    private void onInvClick(InventoryClickEvent event) {
        final InventoryHolder holder = event.getInventory().getHolder();
        if (!(holder instanceof Menu))
        	return;
        
        try {
        	if(event.getClickedInventory().getHolder() instanceof Player) 
        		return;
        } catch (NullPointerException e) {
        	return;
        }
        
        event.setCancelled(((Menu) holder).onClick((Player) event.getWhoClicked(), event.getSlot(), event.getClick()));
    }
	
    @EventHandler 
    private void onOpen(InventoryOpenEvent event) {
        final InventoryHolder holder = event.getInventory().getHolder();
        if (holder instanceof Menu) 
        	((Menu) holder).onOpen((Player) event.getPlayer());
    }
    
    @EventHandler 
    private void onClose(InventoryCloseEvent event) {
        final InventoryHolder holder = event.getInventory().getHolder();
        if (holder instanceof Menu)
        	((Menu) holder).onClose((Player) event.getPlayer(), event.getReason());
    }
}

When opening and closing the inventory immidietly like so:

@EventHandler
	public void onPlayerJoin(PlayerJoinEvent event) {
		Player player = event.getPlayer();
		ClassPickerGui gui = new ClassPickerGui(player, true, plugin);
		player.openInventory(gui.getInventory());
		player.closeInventory();
	}

the inventory updates at pickup item but even if I do

@EventHandler
	public void onPlayerJoin(PlayerJoinEvent event) {
		Player player = event.getPlayer();
		ClassPickerGui gui = new ClassPickerGui(player, true, plugin);
		player.openInventory(gui.getInventory());
		new BukkitRunnable() {
			
			@Override
			public void run() {
				player.closeInventory();
			}
		}.runTask(plugin);
	}

it doesn’t update the inventory on item pickup. I have also tried to comment the events in the inventory holder class and it still the same. Any idea?
(I had limited links so I hade to put code blocks)