Giter Site home page Giter Site logo

Comments (6)

stefvanschie avatar stefvanschie commented on June 15, 2024

From what I understand you have an inventory, that has items put in it via your plugin. This inventory with items then gets shown to a player/players. This player/these players are then supposed to move those items into a different configuration. When you call Gui#update you would like to have those items that may have been moved to retain their moved position? Is that correct?

The main purpose of Gui#update is to update the Gui that is shown when a plugin makes a change to it. E.g. I show a gui to a player via my plugin, then I change something in this gui via my plugin and to then show the changes, I call Gui#update so the player sees the changes the plugin has made. If my understanding of your situation is correct, I don't quite see how we could manage that situation. If we change it so the items don't get moved, then you lose some of the intent of the Gui#update method, since now if your plugin wanted to move an item, you can't display that change to a player, since the framework wouldn't move items. If we keep it like it works now, then when moving an item via a plugin and updating it, the movement is properly displayed, however when a player has moved an item, that one would be moved back as well.

When only considering a StaticPane, the framework could theoretically sort of consider how the movement was done and then adjust to that. Was the movement done by a player: don't update it; was the movement done by a plugin: do update it. However, this gets complicated when taking into account different panes. For example, with an OutlinePane, when you move an item that was in the back of the list of items to the front, all the other items would move as well. What if one of those other items was moved by a player, should this one then move or not? What about items that are in multiple places at once (which can be achieved by adding the same item to a pane multiple times, or with an OutlinePane turning on repeat), which item was actually moved? What if you move two of the same item, but one via a plugin and one as a user? What if the movement of one item, causes a movement of the same item in a different position? What if one item overtook the position of the same item? And then I haven't even considered resizing panes; items overflowing off the inventory; movement caused by pane property updates; movement from the top inventory to the bottom and vice versa and probably a lot of other stuff.

I myself can't think of a way in which such behavior could be handled elegantly. If you or anyone else has an idea on how to do this, I'd love to hear it, but if that's not the case, I won't be implementing this. (If I understood your request wrong, please correct me by the way.)

from if.

pablo67340 avatar pablo67340 commented on June 15, 2024

Yes, I am using IF for GUIShop, and I am revamping the in-game configuration utility. Before, users were required to load the items into a chest and make edits there, however there is a ton of command execution involved so I decided to attempt to change it to use IF. Essentially when they open their shop in editor mode, They are able to remove items and set their prices, lores, etc or even just remove them entirely. This allows users to edit the shop quickly and effortlessly without having YML knowlege.

I have been spending all day trying to implement a way to get this to work, but I am unable to get the PaginatedPane to take on updates.

The Main problem I am having right now involves PaginatedPanes. Some shops can have multiple pages, so when users edit page 1, when they press the arrow to go to page 2, I need the changes the made in page 1 to stay, and not reset back to their initial declaration state. This has proven to be very difficult

from if.

pablo67340 avatar pablo67340 commented on June 15, 2024

It would be beneficial if I could somehow access each page's instance, so I can re-apply my setItem method and make updates there. In order to do that, I would need to be able to get each pane individually which would require a

getPane(PageNumber) method

Perhaps this could work?

from if.

stefvanschie avatar stefvanschie commented on June 15, 2024

A method like that could definitely be implemented, although it probably needs to be called getPanes instead of getPane, since there may be multiple panes on one page.

from if.

pablo67340 avatar pablo67340 commented on June 15, 2024

Thank you so much, that would be amazing.

from if.

stefvanschie avatar stefvanschie commented on June 15, 2024

Version 0.5.13 has his method added.

from if.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.