From fc91c3b56e5fa8b67bedc6902008c5ac3115e760 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 18 Sep 2020 15:02:25 +0100 Subject: [PATCH] Clone mutable regions given to clipboards Fixes #630 --- .../com/boydti/fawe/object/clipboard/ReadOnlyClipboard.java | 2 +- .../sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ReadOnlyClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ReadOnlyClipboard.java index 15695e4c7..ddfa5bb57 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ReadOnlyClipboard.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/ReadOnlyClipboard.java @@ -22,7 +22,7 @@ public abstract class ReadOnlyClipboard extends SimpleClipboard { public ReadOnlyClipboard(Region region) { super(region); - this.region = region; + this.region = region.clone(); } public static ReadOnlyClipboard of(final Region region) { 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 7d1247e77..ac619de26 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 @@ -63,7 +63,7 @@ public class BlockArrayClipboard implements Clipboard { public BlockArrayClipboard(Clipboard clipboard, BlockVector3 offset) { this.parent = clipboard; - Region shifted = clipboard.getRegion(); + Region shifted = clipboard.getRegion().clone(); shifted.shift(offset); this.region = shifted; this.origin = shifted.getMinimumPoint(); @@ -84,7 +84,7 @@ public class BlockArrayClipboard implements Clipboard { checkNotNull(parent); checkNotNull(region); this.parent = parent; - this.region = region; + this.region = region.clone(); this.origin = region.getMinimumPoint(); }