diff --git a/SkyblockCore-Common/src/main/java/me/illusion/skyblockcore/common/database/registry/RegisteredDatabase.java b/SkyblockCore-Common/src/main/java/me/illusion/skyblockcore/common/database/registry/RegisteredDatabase.java index 68b4f66..d2b5f79 100644 --- a/SkyblockCore-Common/src/main/java/me/illusion/skyblockcore/common/database/registry/RegisteredDatabase.java +++ b/SkyblockCore-Common/src/main/java/me/illusion/skyblockcore/common/database/registry/RegisteredDatabase.java @@ -9,6 +9,7 @@ public class RegisteredDatabase { private SkyblockDatabase database; private boolean enabled; + private boolean attemptedLoad; public RegisteredDatabase(SkyblockDatabaseProvider provider, String name) { this.provider = provider; @@ -44,4 +45,12 @@ public void setEnabled(boolean enabled) { public SkyblockDatabaseProvider getProvider() { return provider; } + + public boolean hasAttemptedLoad() { + return attemptedLoad; + } + + public void setAttemptedLoad(boolean attemptedLoad) { + this.attemptedLoad = attemptedLoad; + } } diff --git a/SkyblockCore-Common/src/main/java/me/illusion/skyblockcore/common/database/registry/SkyblockDatabaseRegistry.java b/SkyblockCore-Common/src/main/java/me/illusion/skyblockcore/common/database/registry/SkyblockDatabaseRegistry.java index aa8670e..d04435d 100644 --- a/SkyblockCore-Common/src/main/java/me/illusion/skyblockcore/common/database/registry/SkyblockDatabaseRegistry.java +++ b/SkyblockCore-Common/src/main/java/me/illusion/skyblockcore/common/database/registry/SkyblockDatabaseRegistry.java @@ -118,12 +118,18 @@ public CompletableFuture loadPossible(ConfigurationSection section) { credentialRegistry.checkCyclicDependencies(); Set> temp = new HashSet<>(); + Collection keys = section.getKeys(); for (RegisteredDatabase registeredDatabase : registeredDatabases.values()) { if (registeredDatabase.isEnabled()) { continue; } + if(keys.contains(registeredDatabase.getName())) { + registeredDatabase.setAttemptedLoad(true); + } + + temp.add(tryLoad(registeredDatabase)); } @@ -139,6 +145,10 @@ private CompletableFuture tryLoad(RegisteredDatabase registeredDatabase Object credentials = credentialRegistry.get(registeredDatabase.getName()); if (credentials == null) { + if (!registeredDatabase.hasAttemptedLoad()) { // The database credentials haven't been loaded yet + return CompletableFuture.completedFuture(false); + } + warn("Database {0} has no credentials", registeredDatabase.getName()); return CompletableFuture.completedFuture(false); }