From 8037068dff86d5cbc5203543035c40b84cfdfe85 Mon Sep 17 00:00:00 2001 From: BingZi-233 Date: Tue, 26 Dec 2023 10:19:00 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bilibili/video/internal/engine/NetworkEngine.kt | 8 -------- .../bilibili/video/internal/helper/OkHttpClient.kt | 11 +++++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 src/main/kotlin/online/bingiz/bilibili/video/internal/helper/OkHttpClient.kt diff --git a/src/main/kotlin/online/bingiz/bilibili/video/internal/engine/NetworkEngine.kt b/src/main/kotlin/online/bingiz/bilibili/video/internal/engine/NetworkEngine.kt index 4e3c4c3..6d67fea 100644 --- a/src/main/kotlin/online/bingiz/bilibili/video/internal/engine/NetworkEngine.kt +++ b/src/main/kotlin/online/bingiz/bilibili/video/internal/engine/NetworkEngine.kt @@ -1,6 +1,5 @@ package online.bingiz.bilibili.video.internal.engine -import okhttp3.OkHttpClient import online.bingiz.bilibili.video.api.event.TripleSendRewardsEvent import online.bingiz.bilibili.video.internal.cache.* import online.bingiz.bilibili.video.internal.database.Database @@ -9,8 +8,6 @@ import online.bingiz.bilibili.video.internal.engine.drive.BilibiliApiDrive import online.bingiz.bilibili.video.internal.engine.drive.BilibiliPassportDrive import online.bingiz.bilibili.video.internal.entity.* import online.bingiz.bilibili.video.internal.helper.* -import online.bingiz.bilibili.video.internal.interceptor.ReceivedCookiesInterceptor -import online.bingiz.bilibili.video.internal.interceptor.UserAgentInterceptor import org.bukkit.Bukkit import retrofit2.Call import retrofit2.Callback @@ -18,8 +15,6 @@ import retrofit2.Response import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory import taboolib.common.platform.ProxyPlayer -import taboolib.common.platform.function.pluginId -import taboolib.common.platform.function.pluginVersion import taboolib.common.platform.function.submit import taboolib.common.platform.function.warning import taboolib.module.chat.colored @@ -32,9 +27,6 @@ import taboolib.module.nms.NMSMap * @constructor Create empty Network engine */ object NetworkEngine { - private val client = OkHttpClient.Builder().addInterceptor(ReceivedCookiesInterceptor()) - .addInterceptor(UserAgentInterceptor("MinecraftPlugin $pluginId/$pluginVersion(lhby233@outlook.com)")).build() - /** * Bilibili API * 哔哩哔哩API驱动 diff --git a/src/main/kotlin/online/bingiz/bilibili/video/internal/helper/OkHttpClient.kt b/src/main/kotlin/online/bingiz/bilibili/video/internal/helper/OkHttpClient.kt new file mode 100644 index 0000000..afb2254 --- /dev/null +++ b/src/main/kotlin/online/bingiz/bilibili/video/internal/helper/OkHttpClient.kt @@ -0,0 +1,11 @@ +package online.bingiz.bilibili.video.internal.helper + +import okhttp3.OkHttpClient +import online.bingiz.bilibili.video.internal.interceptor.ReceivedCookiesInterceptor +import online.bingiz.bilibili.video.internal.interceptor.UserAgentInterceptor +import taboolib.common.platform.function.pluginId +import taboolib.common.platform.function.pluginVersion + + +internal val client = OkHttpClient.Builder().addInterceptor(ReceivedCookiesInterceptor()) + .addInterceptor(UserAgentInterceptor("MinecraftPlugin $pluginId/$pluginVersion(lhby233@outlook.com)")).build() \ No newline at end of file