MinusKube / SmartInvs

Advanced Inventory API for your Minecraft Bukkit plugins.
https://minuskube.gitbook.io/smartinvs/
Apache License 2.0
262 stars 65 forks source link

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

Open Valxrie opened 3 years ago

Valxrie commented 3 years ago

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.