I’m working with inventories, and I’m using the following code to get a hotbar:
Hotbar hotbar = inventory.query(Hotbar.class);
The documentation for query states:
org.spongepowered.api.item.inventory.Inventory
public abstract <T extends Inventory> T query(java.lang.Class<?>... types)
Query this inventory for inventories matching any of the supplied types. This is effectively an instanceof check against each child inventory. Logical OR is applied between operands.
Parameters:
types - inventory types (interfaces or classes) to query for
Returns:
the query result
My question is, what happens if there is no matching child inventory? As in, what if I’m trying to get a hotbar from a chest’s inventory, what does this method return then?