Commits

md_5 authored 19b3d5ef4cd
SPIGOT-113: Add save status to ChunkUnloadEvent
No tags

src/main/java/org/bukkit/event/world/ChunkUnloadEvent.java

Modified
3 3 import org.bukkit.Chunk;
4 4 import org.bukkit.event.Cancellable;
5 5 import org.bukkit.event.HandlerList;
6 6
7 7 /**
8 8 * Called when a chunk is unloaded
9 9 */
10 10 public class ChunkUnloadEvent extends ChunkEvent implements Cancellable {
11 11 private static final HandlerList handlers = new HandlerList();
12 12 private boolean cancel = false;
13 + private boolean saveChunk;
13 14
14 15 public ChunkUnloadEvent(final Chunk chunk) {
16 + this(chunk, true);
17 + }
18 +
19 + public ChunkUnloadEvent(Chunk chunk, boolean save) {
15 20 super(chunk);
21 + this.saveChunk = save;
22 + }
23 +
24 + /**
25 + * Return whether this chunk will be saved to disk.
26 + *
27 + * @return chunk save status
28 + */
29 + public boolean isSaveChunk() {
30 + return saveChunk;
31 + }
32 +
33 + /**
34 + * Set whether this chunk will be saved to disk.
35 + *
36 + * @param saveChunk chunk save status
37 + */
38 + public void setSaveChunk(boolean saveChunk) {
39 + this.saveChunk = saveChunk;
16 40 }
17 41
18 42 public boolean isCancelled() {
19 43 return cancel;
20 44 }
21 45
22 46 public void setCancelled(boolean cancel) {
23 47 this.cancel = cancel;
24 48 }
25 49

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut