Skip to content

Commit

Permalink
Fixed some odd debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
IllusionTheDev committed Oct 25, 2023
1 parent c405d18 commit 06fd998
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,18 @@ public CompletableFuture<Void> loadPossible(ConfigurationSection section) {
credentialRegistry.checkCyclicDependencies();

Set<CompletableFuture<?>> temp = new HashSet<>();
Collection<String> keys = section.getKeys();

for (RegisteredDatabase registeredDatabase : registeredDatabases.values()) {
if (registeredDatabase.isEnabled()) {
continue;
}

if(keys.contains(registeredDatabase.getName())) {
registeredDatabase.setAttemptedLoad(true);
}


temp.add(tryLoad(registeredDatabase));
}

Expand All @@ -139,6 +145,10 @@ private CompletableFuture<Boolean> 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);
}
Expand Down

0 comments on commit 06fd998

Please sign in to comment.