From a992f044cdfd365109876e436e35e184ebb22b9d Mon Sep 17 00:00:00 2001 From: Big Pappa Date: Sun, 9 Aug 2026 06:46:27 -0500 Subject: [PATCH] 1.3.0 Fix item pagination and unassigned item placement - Keep unassigned items off earlier assigned pages - Start unassigned items after the last assigned slot - Continue unassigned items on subsequent pages - Prevent unassigned item duplication - Correct pagination for categories with no assigned items - Update maximum page calculation to match pagination behavior --- .../A) Depositing Items.md | 138 ++++++++++++++++++ .../B) Withdrawing Items.md | 103 +++++++++++++ docs/Blank Pages/Depositing-Items.md | 47 ------ docs/Blank Pages/Permissions.md | 2 +- docs/Blank Pages/Subcategories.md | 2 +- docs/Blank Pages/Withdrawing-Items.md | 0 docs/Home.md | 4 +- pom.xml | 2 +- .../rswarehouse/item/ItemsMenu.java | 12 +- .../rswarehouse/item/ItemsPagination.java | 112 +++++++++----- 10 files changed, 326 insertions(+), 96 deletions(-) create mode 100644 docs/02) Depositing And Withdrawing/A) Depositing Items.md create mode 100644 docs/02) Depositing And Withdrawing/B) Withdrawing Items.md delete mode 100644 docs/Blank Pages/Depositing-Items.md delete mode 100644 docs/Blank Pages/Withdrawing-Items.md diff --git a/docs/02) Depositing And Withdrawing/A) Depositing Items.md b/docs/02) Depositing And Withdrawing/A) Depositing Items.md new file mode 100644 index 0000000..7478bfa --- /dev/null +++ b/docs/02) Depositing And Withdrawing/A) Depositing Items.md @@ -0,0 +1,138 @@ +# Depositing Items + +RS-Warehouse provides several ways to deposit items into the Warehouse. + +Items can be deposited using: + +1. **Transaction Menu** +2. **Auto-Deposit** +3. **Warehouse Chest — Automatic Processing** +4. **Warehouse Chest — On Chest Close** +5. **Command — `/shop deposit`** + +Each method ultimately adds the deposited items to the shared Warehouse inventory. + +--- + +## 1. Deposit Through the Transaction Menu + +Items can be deposited directly through the item's **Transaction Menu**. + +Open the Warehouse and select the category containing the item you want to deposit. + +Select the item to open its Transaction Menu. + +From the Transaction Menu, click the wool to set the amount you want to deposit. Deposit amount will be displayed in the +title. Green wool adds to the deposit amount, Red wool will subtract from it. + +Once you have the desired amount set, click the item in the center of the wool. + +📷 Screenshot + + + +> **NOTE:** Variant items such as damaged, enchanted, and partially filled items have their own transaction menus and are handled separately from the primary item. + +--- + +## 2. Auto-Deposit + +**Auto-Deposit** allows you to automatically deposit items when you pick them up. + +Each player has their own Auto-Deposit filter. + +When Auto-Deposit is enabled and you pick up an item that matches one of the items in your filter, RS-Warehouse sends the item directly to the Warehouse instead of placing it into your inventory. + +📷 Screenshot + +### Adding Items to the Auto-Deposit Filter + +Open the **Auto-Deposit** menu from the Warehouse. + +Place an item into the Auto-Deposit menu to add it to your personal filter. + +The item placed into the filter is used as a copy of the item you want to automatically deposit. + +📷 Screenshot + +> **NOTE:** Adding an item to the Auto-Deposit filter does not remove that item from your inventory. + +For more information, see **[Auto-Deposit](...)**. + +--- + +## 3. Warehouse Chest — Automatic Processing + +A **Warehouse Chest** can automatically process its contents at regular intervals. + +The processing interval is controlled by the server's `config.yml`. + +The configured interval determines how often RS-Warehouse checks the Warehouse Chest for items to deposit. + +📷 Screenshot + +> **NOTE:** The automatic processing interval is controlled by the server configuration and may be different on your server. + +--- + +## 4. Warehouse Chest — On Chest Close + +A **Warehouse Chest** can also process its contents when the chest is closed. + +When this option is enabled, RS-Warehouse processes the items in the Warehouse Chest when the player closes the chest. + +📷 Screenshot + +This allows items to be deposited without waiting for the next automatic processing interval. + +> **NOTE:** Chest-close processing and automatic timed processing are separate options controlled by the server configuration. + +--- + +## 5. Command — `/shop deposit` + +Items can also be deposited using the **`/shop deposit`** command. + +This command opens the **Warehouse Deposit** inventory. + +📷 Screenshot + +Place the items you want to deposit into the inventory. + +When the inventory is closed, RS-Warehouse processes the items and adds them to the Warehouse. + +📷 Screenshot + +> **NOTE:** The `/shop deposit` command provides a convenient way to access the Warehouse Deposit inventory without navigating through the Warehouse menus. + +--- + +## New Items + +Items that have not yet been assigned to a category can still be deposited. + +Depending on the server configuration, newly discovered items may be placed into the **Unassigned** category. + +For more information, see **[The Unassigned Category](...)**. + +--- + +## Which Method Should I Use? + +Each deposit method is useful in different situations. + +| Method | Best Used For | +|---|---| +| **Transaction Menu** | Depositing a specific item directly | +| **Auto-Deposit** | Automatically depositing items when picked up | +| **Warehouse Chest — Automatic Processing** | Farms and storage systems that continuously feed a Warehouse Chest | +| **Warehouse Chest — On Chest Close** | Manually placing items into a Warehouse Chest | +| **`/shop deposit`** | Quickly depositing items through a dedicated inventory | + +--- + +## Finished + +RS-Warehouse provides several ways to get items into the Warehouse. + +Choose the method that best fits how you collect and store items on your server. \ No newline at end of file diff --git a/docs/02) Depositing And Withdrawing/B) Withdrawing Items.md b/docs/02) Depositing And Withdrawing/B) Withdrawing Items.md new file mode 100644 index 0000000..1cf353e --- /dev/null +++ b/docs/02) Depositing And Withdrawing/B) Withdrawing Items.md @@ -0,0 +1,103 @@ +# Withdrawing Items + +Items stored in the Warehouse can be withdrawn directly into your inventory. + +The normal withdrawal process is: + +1. Open the Warehouse. +2. Select a category. +3. Select the item you want. +4. Open the item's Transaction Menu. +5. Select **Withdraw**. +6. Choose the amount. +7. Confirm the withdrawal by picking up the item in the center. + +📷 Screenshot + +--- + +## Selecting an Item + +Open the Warehouse and select the category containing the item you want to withdraw. + +📷 Screenshot + +Select the item to open its **Transaction Menu**. + +📷 Screenshot + +The Transaction Menu displays the item currently selected along with its available Warehouse quantity. + +--- + +## Choosing the Withdrawal Amount + +Select **Withdraw** to choose how many items you want to remove from the Warehouse. + +📷 Screenshot + +The amount selection menu allows you to adjust the amount before completing the withdrawal. + +📷 Screenshot + +> **NOTE:** The amount available for withdrawal is limited by the quantity stored in the Warehouse and the amount that can be placed into your inventory. + +--- + +## Completing the Withdrawal + +Confirm the withdrawal to receive the selected items. + +The items are removed from the Warehouse and added to your inventory. + +📷 Screenshot + +The Warehouse quantity is updated after a successful withdrawal. + +--- + +## Withdrawing Variants + +Some items may have variants stored separately from the primary item. + +RS-Warehouse supports transaction menus for: + +- **Damaged Variants** +- **Enchanted Variants** +- **Partially Filled Variants** + +These variants can be selected and withdrawn independently. + +📷 Screenshot + +> **NOTE:** A variant represents a specific version of an item and is handled separately from the primary item. + +--- + +## Inventory Space + +Your available inventory space affects how many items can be withdrawn at one time. + +If your inventory cannot hold the requested amount, the available withdrawal amount is limited accordingly. + +> **IMPORTANT:** Make sure you have enough inventory space before withdrawing large quantities. + +--- + +## Auto-Deposit and Withdrawals + +If an item is configured for **Auto-Deposit**, RS-Warehouse may prevent it from being withdrawn while that Auto-Deposit filter is active. + +If this occurs, remove the item from your Auto-Deposit filter before attempting to withdraw it. + +📷 Screenshot + +For more information, see **[Auto-Deposit](...)**. + +--- + +## Finished + +You can withdraw Warehouse items whenever you need them. + +Use the category and item menus to locate the item, select the desired amount, and complete the withdrawal. \ No newline at end of file diff --git a/docs/Blank Pages/Depositing-Items.md b/docs/Blank Pages/Depositing-Items.md deleted file mode 100644 index 000ef54..0000000 --- a/docs/Blank Pages/Depositing-Items.md +++ /dev/null @@ -1,47 +0,0 @@ -# Depositing Items - -Players can deposit items directly into the warehouse. - ---- - -## Open the Warehouse - -Open the Warehouse Chest. - -📷 Screenshot - ---- - -## Select Deposit - -Choose Deposit. - -📷 Screenshot - ---- - -## Select Items - -Choose the items to deposit. - -📷 Screenshot - ---- - -## Confirmation - -Items are transferred into warehouse storage. - -📷 Screenshot - ---- - -## Finished - -Your items are now available to all authorized players. - ---- - -⬅️ Previous: [Subcategories](Subcategories.md) - -➡️ Next: [Withdrawing Items](Withdrawing-Items.md) \ No newline at end of file diff --git a/docs/Blank Pages/Permissions.md b/docs/Blank Pages/Permissions.md index 38079b2..14d820a 100644 --- a/docs/Blank Pages/Permissions.md +++ b/docs/Blank Pages/Permissions.md @@ -8,6 +8,6 @@ This page documents every permission node used by RS-Warehouse. --- -⬅️ Previous: [Withdrawing Items](Withdrawing-Items.md) +⬅️ Previous: [Withdrawing Items](../02)%20Depositing%20And%20Withdrawing/Withdrawing-Items.md) ➡️ Next: [Commands](Commands.md) \ No newline at end of file diff --git a/docs/Blank Pages/Subcategories.md b/docs/Blank Pages/Subcategories.md index 28e2f80..1a5882e 100644 --- a/docs/Blank Pages/Subcategories.md +++ b/docs/Blank Pages/Subcategories.md @@ -73,4 +73,4 @@ The subcategory is now available. ⬅️ Previous: [Categories](Categories.md) -➡️ Next: [Depositing Items](Depositing-Items.md) \ No newline at end of file +➡️ Next: [Depositing Items](../02)%20Depositing%20And%20Withdrawing/Depositing-Items.md) \ No newline at end of file diff --git a/docs/Blank Pages/Withdrawing-Items.md b/docs/Blank Pages/Withdrawing-Items.md deleted file mode 100644 index e69de29..0000000 diff --git a/docs/Home.md b/docs/Home.md index e288b86..77b0356 100644 --- a/docs/Home.md +++ b/docs/Home.md @@ -9,8 +9,8 @@ - [Auto-Deposit](50%29%20Side%20Pages/Auto-Deposit.md) - [UnCategorized Category](50%29%20Side%20Pages/UnCategorized%20Category.md) -- [Depositing Items] -- [Withdrawing Items] +- [Depositing Items](02%29%20Depositing%20And%20Withdrawing/B%29%20Depositing%20items.md) +- [Withdrawing Items](02%29%20Depositing%20And%20Withdrawing/B%29%20Withdrawing%20items.md) ### Organization diff --git a/pom.xml b/pom.xml index c940564..aac5e91 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ com.rsscripting RS-Warehouse RS-Warehouse - 1.2.0 + 1.3.0 21 diff --git a/src/main/java/com/rsscripting/rswarehouse/item/ItemsMenu.java b/src/main/java/com/rsscripting/rswarehouse/item/ItemsMenu.java index b57489f..11cf3d8 100644 --- a/src/main/java/com/rsscripting/rswarehouse/item/ItemsMenu.java +++ b/src/main/java/com/rsscripting/rswarehouse/item/ItemsMenu.java @@ -84,12 +84,6 @@ public class ItemsMenu { ) ); - List items = - ItemsPagination.getItemsForDisplay( - categoryId, - page - ); - int maxPage = ItemsPagination.getMaximumPage( categoryId @@ -108,6 +102,12 @@ public class ItemsMenu { page ); + List items = + ItemsPagination.getItemsForDisplay( + categoryId, + page + ); + boolean hasPrevious = page > 0; diff --git a/src/main/java/com/rsscripting/rswarehouse/item/ItemsPagination.java b/src/main/java/com/rsscripting/rswarehouse/item/ItemsPagination.java index 643a3d0..fc56f70 100644 --- a/src/main/java/com/rsscripting/rswarehouse/item/ItemsPagination.java +++ b/src/main/java/com/rsscripting/rswarehouse/item/ItemsPagination.java @@ -19,7 +19,7 @@ public class ItemsPagination { int highestAssignedPage = -1; int unassigned = 0; - int lastPageHighestSlot = 8; + int finalAssignedHighestSlot = 8; for (WarehouseItem item : items) { @@ -47,18 +47,25 @@ public class ItemsPagination { } - if (highestAssignedPage < 0) { + /* + * No assigned items means this is a normal unassigned-only list. + */ + if (highestAssignedPage == -1) { - int pages = - (unassigned + 44) / 45; + if (unassigned == 0) { + return 0; + } - return Math.max( - 0, - pages - 1 - ); + return (unassigned - 1) / 45; } + /* + * Only the final assigned page can contain unassigned items. + */ + int finalAssignedPage = + highestAssignedPage + 1; + for (WarehouseItem item : items) { if ( @@ -66,12 +73,12 @@ public class ItemsPagination { && item.slot() != null && - item.page() == highestAssignedPage + 1 + item.page() == finalAssignedPage ) { - lastPageHighestSlot = + finalAssignedHighestSlot = Math.max( - lastPageHighestSlot, + finalAssignedHighestSlot, item.slot() ); @@ -79,25 +86,22 @@ public class ItemsPagination { } - int availableOnLastAssignedPage = + int availableOnFinalAssignedPage = Math.max( 0, - 53 - lastPageHighestSlot + 53 - finalAssignedHighestSlot ); int remainingUnassigned = Math.max( 0, - unassigned - availableOnLastAssignedPage + unassigned - availableOnFinalAssignedPage ); int overflowPages = (remainingUnassigned + 44) / 45; - return Math.max( - 0, - highestAssignedPage + overflowPages - ); + return highestAssignedPage + overflowPages; } @@ -150,7 +154,37 @@ public class ItemsPagination { } /* - * Assigned pages + * Categories with no assigned items are a simple unassigned-only + * list. They begin on page 1 and use all 45 item slots. + */ + if (highestAssignedPage == -1) { + + int start = + page * 45; + + if (start >= unassigned.size()) { + return new ArrayList<>(); + } + + int end = + Math.min( + start + 45, + unassigned.size() + ); + + return new ArrayList<>( + unassigned.subList( + start, + end + ) + ); + + } + + /* + * Assigned pages. Only the final assigned page receives + * unassigned items, and they begin immediately after the + * highest assigned slot on that page. */ if (page <= highestAssignedPage) { @@ -175,9 +209,6 @@ public class ItemsPagination { } - /* - * Unassigned items begin only on the last assigned page. - */ if (page == highestAssignedPage) { int remainingSlots = @@ -186,17 +217,18 @@ public class ItemsPagination { 53 - highestSlot ); - for (int i = 0; - i < remainingSlots && i < unassigned.size(); - i++) { + int end = + Math.min( + remainingSlots, + unassigned.size() + ); - results.add( - unassigned.get( - i - ) - ); - - } + results.addAll( + unassigned.subList( + 0, + end + ) + ); } @@ -205,17 +237,21 @@ public class ItemsPagination { } /* - * Overflow pages contain only unassigned items. + * Pages after the final assigned page contain only unassigned + * items. The first overflow page starts after the unassigned + * items that fit on the final assigned page. */ - int lastPageHighestSlot = 8; + int finalAssignedHighestSlot = 8; + int finalAssignedPage = + highestAssignedPage + 1; for (WarehouseItem item : assigned) { - if (item.page() == highestAssignedPage + 1) { + if (item.page() == finalAssignedPage) { - lastPageHighestSlot = + finalAssignedHighestSlot = Math.max( - lastPageHighestSlot, + finalAssignedHighestSlot, item.slot() ); @@ -226,7 +262,7 @@ public class ItemsPagination { int consumed = Math.max( 0, - 53 - lastPageHighestSlot + 53 - finalAssignedHighestSlot ); consumed =