From 5207981fb232ae3e3b5928ec85e16036898f952b Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Mon, 13 Sep 2021 13:25:11 +0100 Subject: [PATCH] Make clipboard flushable #1286 --- .../core/extent/clipboard/LinearClipboard.java | 3 --- .../worldedit/extent/clipboard/BlockArrayClipboard.java | 5 +++++ .../com/sk89q/worldedit/extent/clipboard/Clipboard.java | 9 ++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/LinearClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/LinearClipboard.java index 2c1bfb36f..0ca503393 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/LinearClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/LinearClipboard.java @@ -49,9 +49,6 @@ public abstract class LinearClipboard extends SimpleClipboard { public abstract Collection getTileEntities(); - public void flush() { - } - @Override protected void finalize() { close(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java index 9fb78632e..496c12538 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java @@ -323,6 +323,11 @@ public class BlockArrayClipboard implements Clipboard { this.parent.close(); } + @Override + public void flush() { + this.parent.flush(); + } + //FAWE start /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java index 0374f305e..a4511e37a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java @@ -52,6 +52,7 @@ import javax.annotation.Nullable; import java.io.Closeable; import java.io.File; import java.io.FileOutputStream; +import java.io.Flushable; import java.io.IOException; import java.io.OutputStream; import java.net.URI; @@ -63,7 +64,9 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Specifies an object that implements something suitable as a "clipboard." */ -public interface Clipboard extends Extent, Iterable, Closeable { +//FAWE start - Iterable, closeable and flushable +public interface Clipboard extends Extent, Iterable, Closeable, Flushable { + //FAWE end //FAWE start static Clipboard create(Region region) { @@ -187,6 +190,10 @@ public interface Clipboard extends Extent, Iterable, Closeable { default void close() { } + @Override + default void flush() { + } + /** * Forwards to {@link #paste(World, BlockVector3, boolean, boolean, Transform)}. */