MinusKube / SmartInvs

Advanced Inventory API for your Minecraft Bukkit plugins.

Home Page:https://minuskube.gitbook.io/smartinvs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Updating 1 item and changing the type of the list returned by InventoryManager#getOpenedPlayers

Valxrie opened this issue · comments

Hi,

I thought it would be interesting having the feature for updating just 1 item in the inventory, without reloading the entire GUI.
This update doesn't remove the item's listener.

To do that I suggest this change in the method InventoryManager#getOpenedPlayers:

public List<UUID> getOpenedPlayers(SmartInventory inv) {
        List<UUID> list = new ArrayList<>();

        this.inventories.forEach((player, playerInv) -> {
            if (inv.equals(playerInv))
                list.add(player);
        });

        return list;
}

A list of players may cause problems inside InventoryContent's implementation (private method update), making the update impossible.