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

Fix exceptions when shooting entities through worlds on folia #5024

Merged

Conversation

Warriorrrr
Copy link
Contributor

The AwardCombatXpTask checks the target's health to see how much damage was done, but running this on the player's scheduler can cause exceptions if the target is not in the same region, like if the target is on the other side of a nether portal.

@nossr50 nossr50 self-assigned this Jun 29, 2024
Copy link
Member

@nossr50 nossr50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a question, sorry for the late review.

@@ -287,6 +287,9 @@ public void attackTarget(LivingEntity target) {
double range = 5;
Player player = getPlayer();

if (!target.getWorld().equals(player.getWorld()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would a player's world not equal their targets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible to shoot an arrow through a nether portal and hit an entity on the other side of it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for that information!

Copy link
Member

@nossr50 nossr50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@nossr50 nossr50 merged commit 93bb160 into mcMMO-Dev:master Aug 31, 2024
1 check passed
@Warriorrrr Warriorrrr deleted the fix/cross-world-folia-exceptions branch September 2, 2024 09:55
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

Successfully merging this pull request may close these issues.

2 participants