9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-28 02:59:13 +00:00

Improve error handling on data sync

This commit is contained in:
William
2023-09-22 22:07:31 +01:00
parent b63e1bd283
commit 55e443cd49
3 changed files with 37 additions and 19 deletions

View File

@@ -53,14 +53,8 @@ import java.util.stream.Collectors;
public abstract class BukkitData implements Data {
@Override
public final void apply(@NotNull UserDataHolder dataHolder, @NotNull HuskSync plugin) {
final BukkitUser user = (BukkitUser) dataHolder;
try {
this.apply(user, (BukkitHuskSync) plugin);
} catch (Throwable e) {
plugin.log(Level.WARNING, String.format("[%s] Failed to apply %s data object; skipping",
user.getUsername(), this.getClass().getSimpleName()), e);
}
public final void apply(@NotNull UserDataHolder dataHolder, @NotNull HuskSync plugin) throws IllegalStateException {
this.apply((BukkitUser) dataHolder, (BukkitHuskSync) plugin);
}
public abstract void apply(@NotNull BukkitUser user, @NotNull BukkitHuskSync plugin) throws IllegalStateException;