SPIGOT-113: Add save status to ChunkUnloadEvent

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2016-07-11 21:10:49 +10:00
parent 0c42c407cf
commit 86e3aea9ba

View file

@ -10,9 +10,33 @@ import org.bukkit.event.HandlerList;
public class ChunkUnloadEvent extends ChunkEvent implements Cancellable { public class ChunkUnloadEvent extends ChunkEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancel = false; private boolean cancel = false;
private boolean saveChunk;
public ChunkUnloadEvent(final Chunk chunk) { public ChunkUnloadEvent(final Chunk chunk) {
this(chunk, true);
}
public ChunkUnloadEvent(Chunk chunk, boolean save) {
super(chunk); 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() { public boolean isCancelled() {