mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2025-01-28 22:41:55 +01:00
Load storage before linked account provider
This commit is contained in:
parent
d70eddeec5
commit
a81e8305a0
@ -694,42 +694,6 @@ public abstract class AbstractDiscordSRV<
|
||||
scheduler().runAtFixedRate(() -> updateChecker.check(false), Duration.ofHours(6));
|
||||
}
|
||||
|
||||
if (flags.contains(ReloadFlag.LINKED_ACCOUNT_PROVIDER)) {
|
||||
LinkedAccountConfig linkedAccountConfig = config().linkedAccounts;
|
||||
if (linkedAccountConfig != null && linkedAccountConfig.enabled) {
|
||||
LinkedAccountConfig.Provider provider = linkedAccountConfig.provider;
|
||||
boolean permitMinecraftAuth = connectionConfig().minecraftAuth.allow;
|
||||
if (provider == LinkedAccountConfig.Provider.AUTO) {
|
||||
provider = permitMinecraftAuth && onlineMode().isOnline() ? LinkedAccountConfig.Provider.MINECRAFTAUTH : LinkedAccountConfig.Provider.STORAGE;
|
||||
}
|
||||
switch (provider) {
|
||||
case MINECRAFTAUTH:
|
||||
if (!permitMinecraftAuth) {
|
||||
linkProvider = null;
|
||||
logger().error("minecraftauth.me is disabled in the " + ConnectionConfig.FILE_NAME + ", "
|
||||
+ "but linked-accounts.provider is set to \"minecraftauth\". Linked accounts will be disabled");
|
||||
break;
|
||||
}
|
||||
dependencyManager.mcAuthLib().downloadRelocateAndLoad().get();
|
||||
linkProvider = new MinecraftAuthenticationLinker(this);
|
||||
logger().info("Using minecraftauth.me for linked accounts");
|
||||
break;
|
||||
case STORAGE:
|
||||
linkProvider = new StorageLinker(this);
|
||||
logger().info("Using storage for linked accounts");
|
||||
break;
|
||||
default: {
|
||||
linkProvider = null;
|
||||
logger().error("Unknown linked account provider: \"" + provider + "\", linked accounts will not be used");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
linkProvider = null;
|
||||
logger().info("Linked accounts are disabled");
|
||||
}
|
||||
}
|
||||
|
||||
if (flags.contains(ReloadFlag.STORAGE)) {
|
||||
if (storage != null) {
|
||||
storage.close();
|
||||
@ -766,6 +730,42 @@ public abstract class AbstractDiscordSRV<
|
||||
}
|
||||
}
|
||||
|
||||
if (flags.contains(ReloadFlag.LINKED_ACCOUNT_PROVIDER)) {
|
||||
LinkedAccountConfig linkedAccountConfig = config().linkedAccounts;
|
||||
if (linkedAccountConfig != null && linkedAccountConfig.enabled) {
|
||||
LinkedAccountConfig.Provider provider = linkedAccountConfig.provider;
|
||||
boolean permitMinecraftAuth = connectionConfig().minecraftAuth.allow;
|
||||
if (provider == LinkedAccountConfig.Provider.AUTO) {
|
||||
provider = permitMinecraftAuth && onlineMode().isOnline() ? LinkedAccountConfig.Provider.MINECRAFTAUTH : LinkedAccountConfig.Provider.STORAGE;
|
||||
}
|
||||
switch (provider) {
|
||||
case MINECRAFTAUTH:
|
||||
if (!permitMinecraftAuth) {
|
||||
linkProvider = null;
|
||||
logger().error("minecraftauth.me is disabled in the " + ConnectionConfig.FILE_NAME + ", "
|
||||
+ "but linked-accounts.provider is set to \"minecraftauth\". Linked accounts will be disabled");
|
||||
break;
|
||||
}
|
||||
dependencyManager.mcAuthLib().downloadRelocateAndLoad().get();
|
||||
linkProvider = new MinecraftAuthenticationLinker(this);
|
||||
logger().info("Using minecraftauth.me for linked accounts");
|
||||
break;
|
||||
case STORAGE:
|
||||
linkProvider = new StorageLinker(this);
|
||||
logger().info("Using storage for linked accounts");
|
||||
break;
|
||||
default: {
|
||||
linkProvider = null;
|
||||
logger().error("Unknown linked account provider: \"" + provider + "\", linked accounts will not be used");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
linkProvider = null;
|
||||
logger().info("Linked accounts are disabled");
|
||||
}
|
||||
}
|
||||
|
||||
if (flags.contains(ReloadFlag.DISCORD_CONNECTION)) {
|
||||
try {
|
||||
if (discordConnectionManager.instance() != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user