Ajneb97 / ConditionalEvents

MIT License
22 stars 12 forks source link

Percentage Bug #42

Open KhrysAK47 opened 9 months ago

KhrysAK47 commented 9 months ago

Using latest version of CE, server based on 1.17.1 PaperSpigot.

If you have a placeholder and an uneven amount of percentages it will glitch out.

For example; - 'message: &f&lCOMMON DROP! &fCommon Handle &7(10%) &b(+%core_magicfind%%&b ✯ Magic Find)'

This will display without parsing the %core_magicfind% placeholder (can be any placeholder, what matters are the %)

However, once I add another percentage at the 10% (so it becomes 10%%) it does display the variable properly, but with double %%.

KhrysAK47 commented 9 months ago

So bug is: you cannot display percentage if you have another placeholder in the line.

Ajneb97 commented 8 months ago

CE thinks you trying to use a variable inside a variable, try using {}:

KhrysAK47 commented 8 months ago

CE thinks you trying to use a variable inside a variable, try using {}:

  • "message: &f&lCOMMON DROP! &fCommon Handle &7(10%) &b(+{core_magicfind}%&b ✯ Magic Find)"

Wouldn't exactly work, because this is an example of how my line looks right now:

- 'message: &c&lSPECIAL FIND! &cDungeon Essence - I &7(50%%) &b(+%math_0_(100+{itemlorecheck_magicfind})%&b% ✯ Magic Find)'

What would I change it to?

KhrysAK47 commented 8 months ago

But that displays with double %, if I disable double % after the 50, it displays as broken variable.

Ajneb97 commented 8 months ago

Sadly this is not possible, since it would require to check every sub string as a variable, which would severely impact performance. I suggest you try to format the message in another way.