9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-31 04:36:45 +00:00

refactor: throw NotRegisteredException if API class provider is bad

This commit is contained in:
William
2024-06-09 14:46:27 +01:00
parent b7aa75fcd5
commit 516c243df8
2 changed files with 13 additions and 6 deletions

View File

@@ -511,17 +511,19 @@ public class HuskSyncAPI {
*/
static final class NotRegisteredException extends IllegalStateException {
private static final String MESSAGE = """
Could not access the HuskSync API as it has not yet been registered. This could be because:
private static final String REASONS = """
This may be because:
1) HuskSync has failed to enable successfully
2) Your plugin isn't set to load after HuskSync has
(Check if it set as a (soft)depend in plugin.yml or to load: BEFORE in paper-plugin.yml?)
3) You are attempting to access HuskSync on plugin construction/before your plugin has enabled.
4) You have shaded HuskSync into your plugin jar and need to fix your maven/gradle/build script
to only include HuskSync as a dependency and not as a shaded dependency.""";
3) You are attempting to access HuskSync on plugin construction/before your plugin has enabled.""";
NotRegisteredException(@NotNull String reasons) {
super("Could not access the HuskSync API as it has not yet been registered. %s".formatted(REASONS));
}
NotRegisteredException() {
super(MESSAGE);
this(REASONS);
}
}