2020import com .alpsbte .plotsystem .utils .io .ConfigPaths ;
2121import com .alpsbte .plotsystem .utils .io .LangPaths ;
2222import com .alpsbte .plotsystem .utils .io .LangUtil ;
23+ import com .fastasyncworldedit .core .extent .clipboard .CPUOptimizedClipboard ;
2324import com .github .fierioziy .particlenativeapi .api .ParticleNativeAPI ;
2425import com .github .fierioziy .particlenativeapi .api .Particles_1_13 ;
2526import com .github .fierioziy .particlenativeapi .plugin .ParticleNativePlugin ;
2627import com .sk89q .worldedit .WorldEditException ;
2728import com .sk89q .worldedit .bukkit .BukkitAdapter ;
2829import com .sk89q .worldedit .bukkit .BukkitWorld ;
29- import com .sk89q .worldedit .extent .clipboard .BlockArrayClipboard ;
3030import com .sk89q .worldedit .extent .clipboard .Clipboard ;
3131import com .sk89q .worldedit .extent .clipboard .io .ClipboardReader ;
3232import com .sk89q .worldedit .extent .clipboard .io .ClipboardWriter ;
@@ -182,7 +182,9 @@ public static boolean isPlayerOnPlot(@NotNull AbstractPlot plot, Player player)
182182 public static @ Nullable CuboidRegion getPlotAsRegion (@ NotNull AbstractPlot plot ) throws IOException {
183183 Clipboard clipboard ;
184184 try (ClipboardReader reader = AbstractPlot .CLIPBOARD_FORMAT .getReader (new ByteArrayInputStream (plot .getInitialSchematicBytes ()))) {
185- clipboard = reader .read ();
185+ clipboard = reader .read (null , dimensions -> new CPUOptimizedClipboard (
186+ new CuboidRegion (null , BlockVector3 .ZERO , dimensions .subtract (BlockVector3 .ONE ))
187+ ));
186188 }
187189 if (clipboard == null ) return null ;
188190
@@ -202,7 +204,9 @@ public static boolean isPlotWorld(@NotNull World world) {
202204 Clipboard clipboard ;
203205 ByteArrayInputStream inputStream = new ByteArrayInputStream (plot .getInitialSchematicBytes ());
204206 try (ClipboardReader reader = AbstractPlot .CLIPBOARD_FORMAT .getReader (inputStream )) {
205- clipboard = reader .read ();
207+ clipboard = reader .read (null , dimensions -> new CPUOptimizedClipboard (
208+ new CuboidRegion (null , BlockVector3 .ZERO , dimensions .subtract (BlockVector3 .ONE ))
209+ ));
206210 }
207211
208212 Polygonal2DRegion region = new Polygonal2DRegion (
@@ -212,7 +216,7 @@ public static boolean isPlotWorld(@NotNull World world) {
212216 clipboard .getMaximumPoint ().y ()
213217 );
214218
215- BlockArrayClipboard newClipboard = new BlockArrayClipboard (region );
219+ Clipboard newClipboard = new CPUOptimizedClipboard (region );
216220 newClipboard .setOrigin (BlockVector3 .at (region .getCenter ().x (), region .getMinimumPoint ().y (), region .getCenter ().z ()));
217221 ForwardExtentCopy copy = new ForwardExtentCopy (
218222 clipboard ,
@@ -262,7 +266,7 @@ public static boolean savePlotAsSchematic(@NotNull Plot plot) throws IOException
262266
263267 // Copy and write finished plot clipboard to schematic
264268 ByteArrayOutputStream outputStream = new ByteArrayOutputStream ();
265- try (Clipboard cb = new BlockArrayClipboard (region )) {
269+ try (Clipboard cb = new CPUOptimizedClipboard (region )) {
266270 cb .setOrigin (BlockVector3 .at (plotCenter .x (), cuboidRegion .getMinimumY (), (double ) plotCenter .z ()));
267271
268272 ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy (Objects .requireNonNull (region .getWorld ()), region , cb , region .getMinimumPoint ());
@@ -293,7 +297,9 @@ public static boolean savePlotAsSchematic(@NotNull Plot plot) throws IOException
293297 Clipboard clipboard ;
294298 ByteArrayInputStream inputStream = new ByteArrayInputStream (plot .getInitialSchematicBytes ());
295299 try (ClipboardReader reader = AbstractPlot .CLIPBOARD_FORMAT .getReader (inputStream )) {
296- clipboard = reader .read ();
300+ clipboard = reader .read (null , dimensions -> new CPUOptimizedClipboard (
301+ new CuboidRegion (null , BlockVector3 .ZERO , dimensions .subtract (BlockVector3 .ONE ))
302+ ));
297303 }
298304 if (clipboard == null ) return null ;
299305
0 commit comments