-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about compatibility implementation #155
Comments
A single gui instance is the same for all viewers. Therefore if you need to display different items or different text for different players (for example, due to their language setting), you should use multiple different gui instances. It's probably easiest if you create a gui instance for a single person. That way you can adjust this single gui instance to the player's settings. This should hopefully answer questions one and two. Refreshing a gui can be done via IF allows you to place panes inside the player's inventory when they have an inventory open. For merged guis (these are barrel, chest, ender chest and shulker box guis) this can simply by done by moving a pane lower done. The gui is assumed to extend across both the top inventory and bottom inventory and act as one whole. For the other guis, you can place the panes in the player inventory component by first getting this component and then adding the pane to it. If you place a pane in the bottom inventory, IF will take care of saving the player's inventory before the gui is opened and restoring it after the gui is closed again. Hopefully this answers your questions. |
Thank you for your very clear answers. There is only one point I am not sure I understood: If I understood correctly, it is not possible to use IF to modify the shortcutbar if there is no open inventory. In other words, IF can save the player's inventory, modify the shortcut bar, and then, when closing the GUI, put the saved inventory back. But all this can only be done when opening (and then closing) an inventory. Do I have this right? |
Another question comes to mind: What happens if: Will the player's inventory be restored in all 3 cases? And in the second case, will the GUI items fall to the ground? |
Yes, that's correct, the inventory of the player can only be modified while a gui is opened since IF is intended for guis, so it essentially does nothing if there's no open gui. The intention is that the player's inventory is always restored (and gui items are not dropped on the ground). I would need to test these specific scenarios you mentioned (and update IF if they happen to not work), but the idea is that these cases are handled. (A server crashing might be a bit troublesome, though.) |
I'm really going to be faced with a complex situation because I would like to develop a feature that I think would benefit from being integrated directly into IF: I would like the shortcutbar to be considered a menu (and could be modified with the pane system you made). Example :
In short, the shortcutbar can then be considered as a kind of GUI in its own right but without an inventory being open. The typical example of this is what I have already done in the https://gitlab.com/lasersenigma/lasersenigma/ plugin. Would you like this feature to be included in IF? If so, would you like to develop it on your own (you will probably go faster as you know the IF code) or would you like my help or that of one of the developers of my association? Otherwise, we could fork your project but it would be a pity as it would make 2 projects to maintain and would force to postpone the evolutions/corrections that could be mutualised from one project to the other. |
While I understand the want for this feature, I feel like this is out-of-scope for this framework. The hotbar itself is not really a gui, which is the target of this framework, especially considering interaction with the hotbar from the player's perspective is completely different than the interaction with a gui. I personally think it'd make more sense to keep these separate, with IF being for guis and some other kind of library/API for just hotbars. |
Ok. That does make sense. However, I think that the amount of code that could be pooled between what IF already does and these new features would justify such a choice (pane system/inventory recover/...). Especially as coding it separately would risk creating conflicts (inventory recover, ...). Anyway, thank you for your clear and useful answers and for your amazing work. In any case, even if my last arguments did not change your mind, we can keep this issue open in order to let you check what's required among those inventory recovering potential error cases:
Or would you prefer to close this issue and to create one separately ? |
Leaving this one open is fine, after those points are done we can then close this. |
As you know I would like to create a ShortcutBarGUI.
What would be the best way to implement it into a fork of IF?
Another option ? Could you please advise me as I am a bit lost when it comes to defining such an architecture within a framework that I know little about ? |
I would go for the second option. IF already has an As for inventory recovering after closing, you could use the Event management and closing is something you'll basically have to do yourself, since events for clicking with items in the shortcut bar are different from clicking in an inventory, so IF doesn't have anything for that. |
Hi, Thanks again for your help. With a developer of the association in which I am a volunteer, we started to work on this modified version of IF. Unfortunately we were quickly blocked by a small configuration problem.
To fix this problem:
Could you please either complete your README.md or your wiki with a contributing guide explaining how to prepare the development environment. Or, simply explain it to us right here ? |
Thank you for your interest in addressing this. Yes, for the Spigot dependencies, running BuildTools for the relevant versions is all you need to do to obtain these files. For the Paper dependencies, the versions are downloaded via the API. Then you can run these JAR files to obtain the patched JAR file. These are then manually installed in the local repository via Maven with the following command.
This is an example for version 1.16.4, but the same is used for other versions, but with different version numbers. That should be everything to get a working environment, but I'll make sure to update the instructions in the README.md as well, so it is clearer as to how you can obtain this environment. |
Hi guys. I just discovered your work and it's really amazing. I was thinking about creating a menu creation library but you developed almost everything I need.
I'm now wondering about how to plug my item library into your framework.
As I am not familiar with your framework, I am creating this issue to exchange with you on this subject and to think about the best way to do what I need. I hope I am not disturbing you in doing so, and if I am, please excuse me and tell me how I should go about it (where to ask such questions).
To be precise it is based on 3 other libs I made (JsonLib, TranslationLib and event-wrapper-lib) but that does not change anything for your understanding.
ItemLib is currently private but it will be published with an open source license in the next months.
I would therefore like to slightly modify or extend your framework in order to meet several needs.
These are my needs:
1 - Show ItemStack according to the player's language.
2 - Translate every text according to the player's language
3 - Be able to refresh/close a GUI according to an event (for example, if the GUI is related to a block and if another player destroy this block, the GUI should be closed)
4 - Your library seems to be only working for Inventories but I would like to also modify the players shortcut bar. In order to do so I have to save the player's inventory (ItemLib does that well) and to replace it by a GUI until the player exit this menu. Do you think I could plug such a feature in your framework (and keep, for example, the pane feature) ?
If you wonder, my library (called, without more imagination, ItemLib) allows plugin developers to :
Please advice
The text was updated successfully, but these errors were encountered: