InfiniteBags | Backpack with Shop 1.3.0
Unlimited per-item storage with a built-in shop hook to sell straight from your bag.
1.3.0
LatestCompatibility
Changes
Two new API methods, so another plugin can read what a bag holds and take items back out of it.
🔌 Reading and Removing
Until now the developer API could only put items into a bag. These two methods let another plugin on your server take them back out, which is what makes a bag usable as a live source of blocks or materials rather than just storage.
long count(UUID player, ItemStack item)
int remove(UUID player, ItemStack item)
countreturns how many of that item type the bag holds. The amount on the item you pass in is ignored. It returns along, because a well-stocked bag can hold more of one type than anintcan expressremovetakes items of that type back out, with the amount on the item you pass in being the quantity to take. It returns how many were actually removed
✂️ Removal Is Partial, On Purpose
Unlike add, which is all or nothing, remove takes what is there. Ask for 5 against a bag holding 3 and you get 3 taken and 3 returned, so the caller can cover the shortfall itself. The return value is always between 0 and the amount you asked for, never more.
A slot drained to zero is deleted rather than left sitting empty, so it frees up for a different item type straight away.
📌 Worth Knowing
- Same grouping as the rest of the API (material plus full NBT hash), so
count(...) > 0is exactly equivalent tocontains(...). A renamed or enchanted block is a different type and is never consumed to satisfy a request for the plain one - Both work offline and are locked per player, like the rest of the API. They are async-safe, touching only the database and in-memory data
- Neither runs a permission check internally. Call
isEnabled(uuid)yourself if you want that gate - Both see items on pages or slots the player's current permissions no longer reach, the ones
/bag recoverexposes, so everythingcountreports is somethingremovecan actually hand over - Null or air items, and null UUIDs, return
0. No exceptions - Calling the API by reflection is supported and now documented
📦 Install
Stop the server, replace the old jar in plugins/ with InfiniteBags-1.3.0.jar, and start it again. No existing method changed behaviour and the storage is untouched, so your bags carry over exactly as they are and anything already built against the API keeps working unchanged.
Join the Discord
Enjoying the plugin? A ⭐ review goes a long way!
Dependencies
Statistics
Views
Purchases
Downloads
File size
Published
Updated
Info
Share & Earn
Share and earn part of the profits, an estimated €0.5 per product sale.