HelpChat / DeluxeMenus

DeluxeMenus but open source!?
https://wiki.helpch.at/clips-plugins/deluxemenus
MIT License
72 stars 35 forks source link

Args in OpenGuiMenu action #30

Closed itsme-to closed 6 months ago

itsme-to commented 8 months ago

Add the support of args in the open gui menu action, really usefull for open menu for a player with arg you can control dans player can't use it.

Like for a shop confirmation have the price and the id in args and open with another menu.

BlitzOffline commented 7 months ago

This is a great idea but it needs to be done right as to maintain backwards compatibility.

Currently, when you open a menu using /menu1-command arg1 arg2 etc. and then inside that menu you use [openguimenu] menu2, all args passed to the first menu will be passed to the second menu.

After spending a bit of time thinking how this might be done best, I found 2 solutions, the first of which I like the most:

  1. Allow args like so: [openguimenu] menu2 arg1 arg2. And to keep backwards compatibility, we can still pass arguments from the current menu as long as they're not overriden in the action.

  2. Add a new action [openguimenuwithargs] menu2 arg1 arg2. This feels a bit bulky.

If anyone has any new ideas, we'll welcome them. I did see a PR was open for this ticket so I'll take a look at that as well.

itsme-to commented 7 months ago

Yes, I didn't know that it retained the arguments, but I saw it later during my pull request. I went with option 1; I think it's the best.

BlitzOffline commented 7 months ago

I've taken a look at #33 and it does seem to mostly align with my first recommendation but there are some things I don't agree with + there are some null and size checks missing which will lead to non handled exceptions.

I am currently working on a PR myself improving on your work @itsme-to. I've left comments on your PR just so you are aware what the issues were.