mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-04-29 14:17:30 +00:00
fix: 修复因 config.json 不存在而引发的启动异常.
当 config.json 不存在时, 当 Launcher 类被加载时, 将导致因 config.json 加载失败而出现类初始化异常, 通过调整访问时机, 修复了这个问题.
This commit is contained in:
parent
a642948f45
commit
285c8b04d1
@ -53,11 +53,6 @@ internal class Launcher : AutoCloseable {
|
|||||||
|
|
||||||
private val botApi = TelegramBotsApi(DefaultBotSession::class.java)
|
private val botApi = TelegramBotsApi(DefaultBotSession::class.java)
|
||||||
private val botSessionMap = mutableMapOf<ScalaBot, BotSession>()
|
private val botSessionMap = mutableMapOf<ScalaBot, BotSession>()
|
||||||
private val remoteRepositories = Const.config.mavenRepositories
|
|
||||||
.map(MavenRepositoryConfig::toRemoteRepository)
|
|
||||||
.toMutableList().apply {
|
|
||||||
add(MavenRepositoryExtensionFinder.getMavenCentralRepository(proxy = Const.config.proxy.toAetherProxy()))
|
|
||||||
}.toList()
|
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun launch(): Boolean {
|
fun launch(): Boolean {
|
||||||
@ -99,6 +94,12 @@ internal class Launcher : AutoCloseable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val account = botConfig.account
|
val account = botConfig.account
|
||||||
|
|
||||||
|
val remoteRepositories = Const.config.mavenRepositories
|
||||||
|
.map(MavenRepositoryConfig::toRemoteRepository)
|
||||||
|
.toMutableList().apply {
|
||||||
|
add(MavenRepositoryExtensionFinder.getMavenCentralRepository(proxy = Const.config.proxy.toAetherProxy()))
|
||||||
|
}.toList()
|
||||||
val extensionPackageFinders = setOf(
|
val extensionPackageFinders = setOf(
|
||||||
MavenRepositoryExtensionFinder(
|
MavenRepositoryExtensionFinder(
|
||||||
remoteRepositories = remoteRepositories,
|
remoteRepositories = remoteRepositories,
|
||||||
|
Loading…
Reference in New Issue
Block a user