Skip to content
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

Could not create math.calc variable if modulo is used #2592

Closed
2 tasks done
J0B10 opened this issue Nov 14, 2023 · 1 comment · Fixed by #2815
Closed
2 tasks done

Could not create math.calc variable if modulo is used #2592

J0B10 opened this issue Nov 14, 2023 · 1 comment · Fixed by #2815
Labels
Bug A bug in the code or in a documentation. Confirmed Something is confimed.

Comments

@J0B10
Copy link
Member

J0B10 commented Nov 14, 2023

Confirm the following

  • I use the latest release or dev-build. I also checked that this problem hasn't already been fixed in a newer dev-build.
  • There are no open or closed issues that are related to my problem.

BetonQuest version information

BetonQuest version: 2.0.0-DEV-754
Server version: git-Paper-196 (MC: 1.20.1)

Hooked into: Citizens (2.0.32-SNAPSHOT (build 3208)), ProtocolLib (5.1.1-SNAPSHOT-673), WorldEdit (7.2.17+6544-56d0383)

Expected behaviour

Math variable should resolve perfectly fine when used, even for modulo operator %, as written in the docs.

Given the following example:

events:
  test: 'log You clearly are a %math.calc:64%32% out of 10.'

Should resolve to: You clearly are a 0 out of 10.'

Actual behaviour

Resolves to: You clearly are a 6432% out of 10.'

Steps to reproduce

events:
  test: 'log You clearly are a %math.calc:64%32% out of 10.'
  1. use above config
  2. run /q reload
  3. run event for a player

Error, Warning, Exception or Thread Dump

Additional information

Question on discord: https://discord.com/channels/407221862980911105/1170834066317254817

@J0B10 J0B10 added Bug A bug in the code or in a documentation. Confirmed Something is confimed. labels Nov 14, 2023
@J0B10 J0B10 self-assigned this Nov 14, 2023
@J0B10
Copy link
Member Author

J0B10 commented Nov 14, 2023

The following Regex is used for detecting variables:

final Matcher matcher = Pattern.compile("%[^ %\\s]+%").matcher(text);

Thats why variables may not contain the % character.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in the code or in a documentation. Confirmed Something is confimed.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant