HelpChat / DeluxeMenus

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

DM parsing PAPI placeholder before parsing Args placeholder #78

Closed ElysiumSMP closed 3 weeks ago

ElysiumSMP commented 3 months ago

Version 1.14.1-DEV-178 Server Version git-Purpur-2158 (MC: 1.20.4)

(Issue opened on advice from Prestley in HelpChat) As described in the title. When trying to get DeluxeMenus to parse something like %luckperms_meta_{player}_wealth%, the placeholder breaks.

BlitzOffline commented 3 months ago

Hello @ElysiumSMP, I have attempted to use the %luckperms_meta_{player}_wealth% placeholder myself but it does not seem to exist. Parsing it even with this command /papi parse me %luckperms_meta_BlitzOffline_wealth% returns nothing. The same as using your example inside a menu.

After taking a look at luckperms' wiki, I could not find any specification of the placeholder you were using. The only similar placeholder I found was %luckperms_meta_wealth%.

Of course, I have set a value for my wealth key using /lp user BlitzOffline meta set wealth abc and the placeholder I found on the wiki does work.

BlitzOffline commented 3 months ago

After looking more over this issue, I have found the root cause. It is a side effect of our changes regarding parsing placeholders inside arguments.

We have previously made some changes to how arguments and placeholders are handled. How it used to work:

How it works now:

These changes were made because we've realized that letting players parse arbitrary placeholders is bad. In my opinion, placeholders should be simple mapping operations without any side effects. Not everyone agrees or sticks by this rule. Some placeholders do things such as giving items to players, executing commands, etc. when they are parsed.

When I've made the changes, I have allowed menu designers to enable placeholder parsing inside arguments on a per-menu basis. I have missed that parsing arguments after parsing placeholders, does not allow menu designers to use arguments inside placeholders anymore.

We might have to revert these changes or add a new option that would allow menu designers to switch the order in which arguments and placeholders are parsed. If we were to add this new option, I think the option that parses placeholders that are inside arguments should be removed.

Feedback is very much appreciated!

ElysiumSMP commented 3 months ago

Hi @BlitzOffline, thank you for your prompt response, and apologies for my relatively late response.

Hello @ElysiumSMP, I have attempted to use the %luckpermsmeta{player}_wealth% placeholder myself but it does not seem to exist. Parsing it even with this command /papi parse me %luckperms_meta_BlitzOffline_wealth% returns nothing. The same as using your example inside a menu.

In response to the above, %luckperms_meta_{player}_wealth% is just an example meta key that utilises an arg within a placeholder. What I was using it for on my server, is to use args to call different data based on what the player specifies:

We might have to revert these changes or add a new option that would allow menu designers to switch the order in which arguments and placeholders are parsed. If we were to add this new option, I think the option that parses placeholders that are inside arguments should be removed.

Thank you for the detailed information. I personally do not really see as much utility in allowing placeholders to be parsed within arguments compared to the former, so I would prefer removing it. Then again I am biased haha.

ElysiumSMP commented 3 months ago

Hi there, any updates here?

ElysiumSMP commented 2 months ago

Bump

BlitzOffline commented 1 month ago

@ElysiumSMP I have opened a PR to add a new option that would fix your issue (#99). If you don't want to wait until that is merged, you can test this build: DeluxeMenus-1.14.1-DEV-local-build.zip