Skip to content

Synchronize access#820

Merged
Raycoms merged 2 commits intoversion/1.21from
synchronize-access
Feb 24, 2026
Merged

Synchronize access#820
Raycoms merged 2 commits intoversion/1.21from
synchronize-access

Conversation

@Raycoms
Copy link
Contributor

@Raycoms Raycoms commented Feb 24, 2026

Closes #
Closes #

Changes proposed in this pull request

  • Synchronize access to avoid concurrency bugs

Testing

  • Yes I tested this before submitting it.
  • I also did a multiplayer test.

Review please

@Raycoms Raycoms merged commit f6baf30 into version/1.21 Feb 24, 2026
5 checks passed
@Raycoms Raycoms deleted the synchronize-access branch February 24, 2026 19:10
handlerCache.clear();
synchronized (handlers)
{
handlers.add(1, handler);
Copy link
Contributor

Choose a reason for hiding this comment

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

I realise you didn't change this, but why is this 1 rather than 0?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess that the AirPlacementHandler should be able to be overridden by adding a new placement handler

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 was for performance reasons, most common ones first.

Comment on lines +117 to +122
case BEFORE:
handlers.add(i - 1, handler);
break;
case AFTER:
handlers.add(i, handler);
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is incorrect; BEFORE should be i and AFTER should be i + 1.

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.

4 participants