From 86e3aea9ba98adff6240bc72a09cbe6811c8cab2 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Mon, 11 Jul 2016 21:10:49 +1000 Subject: [PATCH] SPIGOT-113: Add save status to ChunkUnloadEvent By: md_5 --- .../bukkit/event/world/ChunkUnloadEvent.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/event/world/ChunkUnloadEvent.java b/paper-api/src/main/java/org/bukkit/event/world/ChunkUnloadEvent.java index f59d0914de..aa8573dcec 100644 --- a/paper-api/src/main/java/org/bukkit/event/world/ChunkUnloadEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/world/ChunkUnloadEvent.java @@ -10,9 +10,33 @@ import org.bukkit.event.HandlerList; public class ChunkUnloadEvent extends ChunkEvent implements Cancellable { private static final HandlerList handlers = new HandlerList(); private boolean cancel = false; + private boolean saveChunk; public ChunkUnloadEvent(final Chunk chunk) { + this(chunk, true); + } + + public ChunkUnloadEvent(Chunk chunk, boolean save) { super(chunk); + this.saveChunk = save; + } + + /** + * Return whether this chunk will be saved to disk. + * + * @return chunk save status + */ + public boolean isSaveChunk() { + return saveChunk; + } + + /** + * Set whether this chunk will be saved to disk. + * + * @param saveChunk chunk save status + */ + public void setSaveChunk(boolean saveChunk) { + this.saveChunk = saveChunk; } public boolean isCancelled() {