Check Items Inside Menu
The methods for check the items player add to your menu, if you set up to allow players add items to specific slots and limit the amount player can add.
This class works independent from the menu classes, so you can use this class for other inventory's also.
Check inventory
This method handle the main method for checking your provided inventory for both amount of items and if the items is blacklisted. Returns only the valid items after your set preferences, rest go to the player automatically or end up on the ground if player not have space left.
This method give you option to set if it shall check duplicates, beside the player involved and inventory you want to check.
public Map<Integer, ItemStack> getItemsFromSetSlots(final Inventory inv, final Player player, final boolean shallCheckDuplicates);
This method will check for duplicate items as default.
public Map<Integer, ItemStack> getItemsFromSetSlots(final Inventory inv, final Player player);
If player is null or you want the items end up on the ground set the player to null. This method will also check if player trying to add duplicate items.
public Map<Integer, ItemStack> getItemsFromSetSlots(final Inventory inv, final Player player, final Location location);
This is the full method where you can self choose the behavior and set if player should be null or not. You should not set both player and location to null at the same time.
public Map<Integer, ItemStack> getItemsFromSetSlots(final Inventory inv, final Player player, final Location location, final boolean shallCheckDuplicates);
Black list
The blacklist add option to disallow one or several items to be added to this menu. It will be cached and then sent back to the player.
public void setBlacklistedItems(final List<ItemStack> blacklistedItems);
Slots to check
Retrieve the slots you want to check.
Retrieve the slots you want to check.
public List<Integer> getSlotsToCheck();
Set one or several slots with varargs. It will clear all old slots added before.
public void setSlotsToCheck(final int... slotsToCheck);
Set a list of slots you want to check inside the inventory.
setSlotsToCheck(final List<Integer> slotsToCheck);
Filter type
Set the type of filter you want for the blacklisted items you added. It does only contains 3 options match only the type, all set data on the item (will ignore the amount player added) and type with their set name and lore.
public void setFilterMatch(@Nonnull FilterMatch filterMatch);
Set up own match logic
You can provide your own match logic, if the options does not suffice with your criteria.
public void setMatchCheck(@Nonnull MatchCheckItemStack checkItemStack);
Last updated