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

Folia support #570

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Folia support #570

wants to merge 14 commits into from

Conversation

Anon8281
Copy link


public class BCauldron {
public static final byte EMPTY = 0, SOME = 1, FULL = 2;
public static final int PARTICLEPAUSE = 15;
public static Random particleRandom = new Random();
private static Set<UUID> plInteracted = new HashSet<>(); // Interact Event helper
public static Map<Block, BCauldron> bcauldrons = new HashMap<>(); // All active cauldrons. Mapped to their block for fast retrieve
public volatile static Map<Block, BCauldron> bcauldrons = new ConcurrentHashMap<>(); // All active cauldrons. Mapped to their block for fast retrieve
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason why you added volatile to this Map? It is already a ConcurrentHashMap, did you find a reason that this has to be added?

Copy link
Author

Choose a reason for hiding this comment

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

Just in case. I'm not sure about the need for this

// for example when removing it with some world editor
barrel.checked = true;
}
P.getScheduler().runTaskTimer(barrel.getSpigot().getLocation(), () -> {
Copy link
Member

Choose a reason for hiding this comment

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

As far as i understand the Scheduler, this will run the Task in the Region for that Location.
Considering we load all Barrels on server start, they could all over the world and in multiple worlds. Many of them not loaded and in regions that do not exist at the moment.
So this would cause Folia to create the missing regions if im correct?
Is there a way to only run the Task if the region exists?

Copy link
Author

@Anon8281 Anon8281 Oct 30, 2023

Choose a reason for hiding this comment

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

Could there be a case where a barrel would be in a non-existent region? If someone installed it, then the region was created before, right?

Choose a reason for hiding this comment

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

Not if the plugin folder is moved to another server with a new map. If they forget about it, then it will throw errors. It may be an edgecase but important to have in mind

@Sn0wStorm
Copy link
Member

I like the idea of adding Folia :) Have you found any other issues with this so far?

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