itsme-to / ItsMyConfig

A plugin that facilitates the work of configurators and adds functionalities to customize each message.
https://docs.itsme.to/itsmyconfig
GNU General Public License v3.0
4 stars 5 forks source link

[BUG] when you use the prefix do not pair well a placeholder that returns another one #15

Closed Zarkness closed 4 weeks ago

Zarkness commented 1 month ago

Describe the bug. when you use the prefix and use and the placeholder returns another placeholder it does not match the placeholder for the second time.

Replay Steps to reproduce the behavior:

  1. create a placeholder in another plugin than itsmyconfig for example itsmymeta or any other where the value is another placeholder for example %itsmymeta_test%.
  2. for now go for example to ajparkour and in the rewards message put $.
  3. now when you get the reward message you will see that the value of the placeholder becomes %itsmymeta_test_placeholder% instead of the value of that placeholder

Expected behavior as many times as necessary until the final result is returned. Screenshots** the expected result should be hello > but it comes out %itsmymeta_testing_placeholder2% >, instead when I use that placeholder in the tab for example it returns hello > instead if the value of the second placeholder instead of being %% is with if it parses it and I don't want to have 50 placeholders for the same thing but to use each one in a different side.

image image image

image image

Software (complete the following information): Spigot: [e.g., Paper

itsme-to commented 1 month ago

Hi, it's a problem with ItsMyMeta which doesn't parse the Placeholders inside rather than ItsMyConfig

Zarkness commented 1 month ago

Hi, it's a problem with ItsMyMeta which doesn't parse the Placeholders inside rather than ItsMyConfig

@itsme-to if it was itsmymeta thing would happen the same in any other plugin where I put a placeholder of itsmymeta, but only happens to me with the prefix of itsmyconfig, besides I'm testing by editing the code I added support for parse placeholders that are between %% and then if I parse it, so it is not itsmymeta thing

Zarkness commented 1 month ago

if it were a itsmymeta thing then the tab would give me the same as with the itsmyconfig prefix and instead as you see in the penultimate image it parses it.

Zarkness commented 4 weeks ago

@itsme-to any news about this bug?

itsme-to commented 4 weeks ago

Hello, that not really a bug and ItsMyMeta that need improuvement, we removed the default placeholder format for optimisation and because it's create error with some plugin

Zarkness commented 4 weeks ago

@itsme-to I added this line of code to test, it still does not support placeholders other than those with the tag and it parses it to the end, so it is not itsmymeta and other plugins, it is itsmyconfig, it does not parse external placeholders that have nested placeholders.

            final String parsedPlaceholder = PlaceholderAPI.setPlaceholders(player, '%' + papiPlaceholder + '%');

            // Reparse the placeholder until no more placeholders are found
            String previousParsed;
            do {
                previousParsed = parsedPlaceholder;
                parsedPlaceholder = PlaceholderAPI.setPlaceholders(player, previousParsed);
            } while (!previousParsed.equals(parsedPlaceholder));
itsme-to commented 4 weeks ago

ItsMyConfig supports nested placeholders; you just need to follow ItsMyConfig's format and not use %%. Additionally, it's the job of ItsMyMeta to return the actual value instead of placeholders, so each plugin doesn't have to adapt to it.

ItsMyConfig handles this quite well and normally never returns placeholders.

Zarkness commented 4 weeks ago

It should also support nested placeholders with the legacy format since I am not going to create 2 different placeholders for the same result when those lines of code already solve that problem.

itsme-to commented 4 weeks ago

You are free to use your own fork, we will normally redev ItsMyMeta soon anyway

Zarkness commented 4 weeks ago

Ok and a question about itsmymeta and its new dev, will it continue to have the teams section?

itsme-to commented 4 weeks ago

Yes