Adding chunk serialization events#9990
Closed
derverdox wants to merge 2 commits into
Closed
Conversation
Removing unneccesary class from patch
kennytv
requested changes
Dec 2, 2023
| + | ||
| + @Nullable | ||
| + public Chunk getChunk() { | ||
| + return this.chunk; |
Member
There was a problem hiding this comment.
This should get docs as to when the chunk is null or not null
| +import org.jetbrains.annotations.Nullable; | ||
| + | ||
| +public abstract class ChunkDataEvent extends Event { | ||
| + private static final HandlerList handlers = new HandlerList(); |
Member
There was a problem hiding this comment.
Uppercase name for static final fields
| + */ | ||
| +public class ChunkDeserializeEvent extends ChunkDataEvent { | ||
| + private static final HandlerList handlers = new HandlerList(); | ||
| + public ChunkDeserializeEvent(@NotNull final World world, @Nullable final Chunk chunk, final int chunkX, final int chunkZ, @NotNull final PersistentDataContainer chunkPersistentDataContainer) { |
Member
There was a problem hiding this comment.
Extra line between the field and constructor
Comment on lines
+15
to
+17
| + // Paper start - add ChunkDataEvents | ||
| + toSerialize = ChunkSerializer.saveChunk(this.world, this.chunk, this.asyncSaveData, false); | ||
| + // Paper end - add ChunkDataEvents |
Member
There was a problem hiding this comment.
Single line changes just get a // Paper - ... comment at the end of the line
| import org.bukkit.inventory.InventoryView; | ||
| import org.bukkit.inventory.Recipe; | ||
| import org.bukkit.inventory.meta.BookMeta; | ||
| +import org.bukkit.persistence.PersistentDataContainer; |
Member
There was a problem hiding this comment.
Especially in this class it's going to be ugly, but please remove the added imports and instead fully qualify them when used in code to reduce diff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch adds new Chunk events that are called during the serialization / generation process of chunks.
A problem some developers may face while using the ChunkLoad or ChunkUnload events is the fact that they are called synchronously.
These proposed events are called during the process.
The use case of such events is that heavy saving / loading tasks from cache to the chunk nbt container or vice versa are executed asynchronously aswell but in the same thread
that saves / loads / generates the chunk.