actually rollback on error in registry events.

Signed-off-by: cpw <cpw+github@weeksfamily.ca>
This commit is contained in:
cpw 2020-11-01 19:51:56 -05:00
parent 749c9063af
commit cf3e9d1e0c
No known key found for this signature in database
GPG key ID: 8EB3DF749553B1B7

View file

@ -374,11 +374,12 @@ public class GameData
}
public static CompletableFuture<List<Throwable>> checkForRevertToVanilla(final Executor executor, final CompletableFuture<List<Throwable>> listCompletableFuture) {
return listCompletableFuture.thenApplyAsync(errors -> {
if (!errors.isEmpty()) {
return listCompletableFuture.whenCompleteAsync((errors, except) -> {
if (except != null) {
LOGGER.fatal("Detected errors during registry event dispatch, rolling back to VANILLA state");
revertTo(RegistryManager.VANILLA, false);
LOGGER.fatal("Detected errors during registry event dispatch, roll back to VANILLA complete");
}
return errors;
}, executor);
}