@@ -297,22 +297,25 @@ public int size() {
297
297
}
298
298
299
299
/**
300
- * Save this hologram to a file.
300
+ * Save this hologram to a file asynchronously .
301
301
*/
302
302
public boolean save () {
303
- if (!saveToFile ) return true ;
304
- config .set ("location" , LocationUtils .asString (location , false ));
305
- config .set ("enabled" , enabled );
306
- config .set ("permission" , permission == null || permission .isEmpty () ? null : permission );
307
- config .set ("flags" , flags .isEmpty () ? null : flags .stream ().map (EnumFlag ::name ).collect (Collectors .toList ()));
308
- config .set ("display-range" , displayRange );
309
- config .set ("update-range" , updateRange );
310
- config .set ("update-interval" , updateInterval );
311
- config .set ("facing" , facing );
312
- config .set ("down-origin" , downOrigin );
313
- config .set ("pages" , pages .stream ().map (HologramPage ::serializeToMap ).collect (Collectors .toList ()));
314
- config .saveData ();
315
- config .reload ();
303
+ if (saveToFile ) {
304
+ S .async (() -> {
305
+ config .set ("location" , LocationUtils .asString (location , false ));
306
+ config .set ("enabled" , enabled );
307
+ config .set ("permission" , permission == null || permission .isEmpty () ? null : permission );
308
+ config .set ("flags" , flags .isEmpty () ? null : flags .stream ().map (EnumFlag ::name ).collect (Collectors .toList ()));
309
+ config .set ("display-range" , displayRange );
310
+ config .set ("update-range" , updateRange );
311
+ config .set ("update-interval" , updateInterval );
312
+ config .set ("facing" , facing );
313
+ config .set ("down-origin" , downOrigin );
314
+ config .set ("pages" , pages .stream ().map (HologramPage ::serializeToMap ).collect (Collectors .toList ()));
315
+ config .saveData ();
316
+ config .reload ();
317
+ });
318
+ }
316
319
return true ;
317
320
}
318
321
0 commit comments