Catch exceptions during hook initialization

This commit is contained in:
William committed 2023-06-17 19:19:10 +01:00
1 parent ae54242cbf
commit 25f183635d
3 files changed
+21 -3

No files matched your search

@@ -185,7 +185,13 @@ public class FabricHuskHomes implements DedicatedServerModInitializer, HuskHomes
this.registerHooks();
if (hooks.size() > 0) {
hooks.forEach(Hook::initialize);
hooks.forEach(hook -> {
try {
hook.initialize();
} catch (Throwable e) {
log(Level.WARNING, "Failed to initialize " + hook.getName() + " hook", e);
}
});
log(Level.INFO, "Registered " + hooks.size() + " mod hooks: " + hooks.stream()
.map(Hook::getName)
.collect(Collectors.joining(", ")));