Unloading chunks when blocked the main thread by a plugin

Hello! Can chunks unload themselves during a very cumbersome operation in the main thread with intensive loading of chunks, without causing an OutOfMemoryError? Or do I need to call the unload methods myself?

In other words, the question is, does automatic loading and unloading of chunks work in the same thread with plugins or not?

99% of minecraft needs to work in the main thread, this includes plugins and mods that interact with the server. The only thing I can think of that isn’t in the main thread is chat and the servers lighting (server lighting is thanks to a sponge optimization)

So to answer you question, yes, plugins and chunk loading/unloading occurs in the same thread.

The exception to this rule is custom made servers that do not run on mojang code, something like Glowstone (BukkitAPI) or Lantern (SpongeAPI) as these were designed with threads in mind.

1 Like