-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
[Bugfix] Fix infinite loop in TranslationTask #721
base: main
Are you sure you want to change the base?
Conversation
Movecraft/src/main/java/net/countercraft/movecraft/async/translation/TranslationTask.java
Outdated
Show resolved
Hide resolved
test = test.translate(0, -1, 0); | ||
} | ||
Material testType = test.toBukkit(world).getBlock().getType(); | ||
if (craft.getType().getMaterialSetProperty(CraftType.FORBIDDEN_HOVER_OVER_BLOCKS).contains(testType)) { | ||
// Why is there no return here? Shouldnt there be one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a serious question i have there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it seems i confused the lines when i wrote that comment, but anyway. Once the craft goes over a forbidden hover over block, it can't translate at all. Calling fail also pretty much implies that the result is final at that point, but yet the function would continue, so the return is necessary
Describe in detail what your pull request accomplishes
There is a infinite loop in TranslationTask.java in the validation for forbidden hover blocks. In short, the position moves out of worldspace and thus the returned block will always be air, resulting in a infinite loop.
Also fixed a probably missing return statement further down, if a block was found that can't be hovered over
Related issues:
Checklist