Fix game-related data not saving

This commit is contained in:
KingRainbow44 2023-05-30 18:47:05 -04:00
parent 31a02050cf
commit bef455d50c
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE

View File

@ -1,7 +1,5 @@
package emu.grasscutter.database; package emu.grasscutter.database;
import static com.mongodb.client.model.Filters.eq;
import dev.morphia.query.FindOptions; import dev.morphia.query.FindOptions;
import dev.morphia.query.Sort; import dev.morphia.query.Sort;
import dev.morphia.query.experimental.filters.Filters; import dev.morphia.query.experimental.filters.Filters;
@ -23,10 +21,13 @@ import emu.grasscutter.game.quest.GameMainQuest;
import emu.grasscutter.game.world.SceneGroupInstance; import emu.grasscutter.game.world.SceneGroupInstance;
import emu.grasscutter.utils.objects.Returnable; import emu.grasscutter.utils.objects.Returnable;
import io.netty.util.concurrent.FastThreadLocalThread; import io.netty.util.concurrent.FastThreadLocalThread;
import java.util.List; import java.util.List;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.stream.Stream; import java.util.stream.Stream;
import static com.mongodb.client.model.Filters.eq;
public final class DatabaseHelper { public final class DatabaseHelper {
private static final ExecutorService eventExecutor = private static final ExecutorService eventExecutor =
new ThreadPoolExecutor( new ThreadPoolExecutor(
@ -53,7 +54,7 @@ public final class DatabaseHelper {
* @param object The object to save. * @param object The object to save.
*/ */
public static void saveGameAsync(Object object) { public static void saveGameAsync(Object object) {
DatabaseHelper.eventExecutor.submit(() -> DatabaseHelper.saveGameAsync(object)); DatabaseHelper.eventExecutor.submit(() -> DatabaseManager.getGameDatastore().save(object));
} }
/** /**