[SPIGOT-2527] Ability to differentiate between inventory sections. Created: 15/Jul/16 Updated: 14/Apr/19 Resolved: 14/Apr/19 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | New Feature | Priority: | Minor |
Reporter: | PixelPerfect | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | InventoryType, inventory | ||
Environment: |
* |
Plugin: | * |
Description |
Example: This could be resolved through the introduction of a new API that itself reports which section of the inventory (For the example above, CombinedInventorySection.PLAYER would be an easily checked solution for problems like the example above). |
Comments |
Comment by md_5 [ 14/Apr/19 ] |
InventoryView.getInventory |
Comment by PixelPerfect [ 16/Jul/16 ] |
Good point, an alternative may be a couple enums to the earlier mentioned InventoryView and have it return that, then there could be 'OUTSIDE' 'REMOTE' 'LOCAL'. |
Comment by Black Hole [ 16/Jul/16 ] |
I think you'll need both methods since the slot number could be outside of both inventories. |
Comment by PixelPerfect [ 16/Jul/16 ] |
That would be an ideal way of doing it. Could even just be one method named something like isRemoteInventoryView(int remoteSlots, int rawSlot) |
Comment by Black Hole [ 16/Jul/16 ] |
So new methods InventoryView.isTopInventory(int rawSlot) and InventoryView.isBottomInventory(int rawSlot) could be useful. |
Comment by BillyGalbreath [ 16/Jul/16 ] |
Get the rawslot number and compare it to the inventory size. Thats how you know which side of the inventory was clicked. |
Comment by Hex [ 16/Jul/16 ] |
Re-opened as per reporter's request. Apparently the inventory view reported isn't actually helpful in this way. |
Comment by PixelPerfect [ 16/Jul/16 ] |
InventoryView.OUTSIDE may be the solution, hard to tell what it does seeing as it has next to no documentation. Other than that, that leads back into InventoryType which is horribly broken and cannot be updated to keep the API backwards-compatible. EDIT: Following checking the source, I can confirm that OUTSIDE only defines -999 which is a reference to literally clicking outside of the inventory slots. |
Comment by Black Hole [ 15/Jul/16 ] |
It's already there: |