22
33import dev .lrxh .api .arena .IArena ;
44import dev .lrxh .blockChanger .snapshot .CuboidSnapshot ;
5- import dev .lrxh .neptune .Neptune ;
65import dev .lrxh .neptune .configs .impl .SettingsLocale ;
76import dev .lrxh .neptune .game .arena .allocator .Allocation ;
87import dev .lrxh .neptune .game .arena .allocator .SpatialAllocator ;
@@ -98,6 +97,7 @@ public boolean isSetup() {
9897 }
9998
10099 public synchronized CompletableFuture <Arena > createDuplicate () {
100+
101101 if (snapshot == null ) {
102102 CompletableFuture <Arena > failed = new CompletableFuture <>();
103103 failed .completeExceptionally (new IllegalStateException ("CuboidSnapshot not ready" ));
@@ -127,23 +127,22 @@ public synchronized CompletableFuture<Arena> createDuplicate() {
127127
128128 final int originalMinChunkX = min .getBlockX () >> 4 ;
129129 final int originalMinChunkZ = min .getBlockZ () >> 4 ;
130-
131130 final int chunkOffsetX = allocation .chunkX - originalMinChunkX ;
132131 final int chunkOffsetZ = allocation .chunkZ - originalMinChunkZ ;
133-
134132 final int offsetBlocksX = chunkOffsetX * 16 ;
135133 final int offsetBlocksZ = chunkOffsetZ * 16 ;
136134
137-
138135 Location newRedSpawn = (this .redSpawn != null ? LocationUtil .addOffset (this .redSpawn .clone (), offsetBlocksX , offsetBlocksZ ) : null );
139136 Location newBlueSpawn = (this .blueSpawn != null ? LocationUtil .addOffset (this .blueSpawn .clone (), offsetBlocksX , offsetBlocksZ ) : null );
140137 Location newMin = LocationUtil .addOffset (this .min .clone (), offsetBlocksX , offsetBlocksZ );
141138 Location newMax = LocationUtil .addOffset (this .max .clone (), offsetBlocksX , offsetBlocksZ );
142139
143140 CompletableFuture <Arena > future = new CompletableFuture <>();
141+
144142 snapshot .offset (offsetBlocksX , offsetBlocksZ )
145143 .thenApplyAsync (cuboidSnapshot -> {
146- cuboidSnapshot .restore (true );
144+ cuboidSnapshot .restore (false );
145+
147146 return new Arena (
148147 this .name + "#" + currentIndex ,
149148 this .displayName ,
@@ -166,11 +165,13 @@ public synchronized CompletableFuture<Arena> createDuplicate() {
166165 } else {
167166 future .complete (arena );
168167 }
168+
169169 });
170170
171171 return future ;
172172 }
173173
174+
174175 public List <String > getWhitelistedBlocksAsString () {
175176 List <String > result = new ArrayList <>();
176177 for (Material mat : whitelistedBlocks ) {
@@ -200,7 +201,7 @@ public void remove() {
200201
201202 public void restore () {
202203 if (snapshot != null ) {
203- snapshot .restore (true );
204+ snapshot .restore (false );
204205 }
205206 }
206207
0 commit comments