updating inventory

Discussion in 'Spigot Plugin Development' started by TheFuzzyHead5, May 7, 2017.

  1. How can I efficiently update a gui?

    This means that the mouse does not reset, and, for example, an item could have a countdown lore which would update. An example is on.. well everywhere.. but Mineplex where they update the compass menu (and many more).

    My options are:
    - player.updateInventory() - don't know much about it other than it resets the mouse
    - repeat opening GUI - inefficient, flickers

    • Friendly Friendly x 1
  2. just clear the inventory if needed and put new items in there
    • Like Like x 1
    • Agree Agree x 1
  3. And that won't flicker?
  4. I'm fairly certain (in the case of making a countdown lore timer) that setting the new item into the old place won't change the position of the cursor or make a flicker.
  5. How do you advise I go about this?

    Using a repeating task and cancel it when they no longer have the inv open?
  6. Yes, that's how I would do it.
  7. I would do so, would clear the inventory would put the new items or if to make counting with items just change an item count and would give updateInventory
    • Like Like x 1
  8. Why not only update the item meta of the items inside.. Rather than removing all items and put them back which is bad..
    • Agree Agree x 2
  9. In his case it really would be better just to give itemMeta uptime and then give Inventory update, but I do what I quoted in my previous post when I have to keep swapping the inventory items as a Menu
  10. Just open a new inventory. That won't reset the mouse pointer. If you only want to update the item meta just get the item and set new item meta and update inventory to all the viewers.
  11. It does reset for 1.11 & PaperSpigot.

    I would reccoment you to open inventory only on item lore change, so it still will reset mouse point to center but will only do it once it will update
  12. Simply, don't open the Inventory again and only update the item, this how i do it with my API.