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

Cannot switch to final page when using a numerical value for the page Reward Type #102

Open
Thatsmusic99 opened this issue Mar 31, 2021 · 0 comments

Comments

@Thatsmusic99
Copy link

When using the page reward type in the pagelayout.yml file, you can never switch to the final page when using the actual page value (e.g. 3, 4) - it switches to the page before that instead.

Files used to reproduce:

menu.yml - https://pastebin.com/2zCv8r25
buy-menu.yml - https://pastebin.com/TSs12q5Q
pagelayout.yml - https://pastebin.com/0qJYDhAm

The line of code that I suspect to cause this is the following:

int page = Math.max(0, Math.min(Integer.valueOf(reward), shopholder.getHighestPage()));

Rather than using getHighestPage (which would return 3 in this scenario), getDisplayHighestPage should be used in this scenario. I did also test it in my own environment with that method instead, and that fixed the problem. I did test the fix with an erroneous input as well (page 5 when there were only 4 pages) and the plugin responded fine.

If required I can open a pull request for this but this is a tiny fix I'm sure can also be done yourself, I just wanted to highlight the actual cause (since I'm like that, unfortunately for a lot of people ;) ).

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant