diff --git a/gradle.properties b/gradle.properties index f351da1c..08640c63 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,6 +7,6 @@ org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled javaVersion=25 mcVersion=26.2 group=dev.slne.surf.api -version=3.33.0 +version=3.33.1 relocationPrefix=dev.slne.surf.api.libs snapshot=false diff --git a/surf-api-paper/surf-api-paper-server/src/main/kotlin/dev/slne/surf/api/paper/server/PaperMain.kt b/surf-api-paper/surf-api-paper-server/src/main/kotlin/dev/slne/surf/api/paper/server/PaperMain.kt index 7a5a5c1c..2de100c6 100644 --- a/surf-api-paper/surf-api-paper-server/src/main/kotlin/dev/slne/surf/api/paper/server/PaperMain.kt +++ b/surf-api-paper/surf-api-paper-server/src/main/kotlin/dev/slne/surf/api/paper/server/PaperMain.kt @@ -1,13 +1,18 @@ package dev.slne.surf.api.paper.server import com.github.shynixn.mccoroutine.folia.SuspendingJavaPlugin +import dev.slne.surf.api.paper.api.metrics.Metrics import dev.slne.surf.api.paper.server.impl.scoreboard.SurfScoreboardApiImpl import dev.slne.surf.api.paper.server.libs.LibLoader import org.bukkit.plugin.java.JavaPlugin class PaperMain : SuspendingJavaPlugin() { + + lateinit var bstats: Metrics + override suspend fun onLoadAsync() { LibLoader(classLoader).loadLibs() + bstats = Metrics(this, 29465) PaperInstance.onLoad() } @@ -17,6 +22,10 @@ class PaperMain : SuspendingJavaPlugin() { } override suspend fun onDisableAsync() { + if (::bstats.isInitialized) { + bstats.shutdown() + } + SurfScoreboardApiImpl.INSTANCE.onDisable() PaperInstance.onDisable() } diff --git a/surf-api-velocity/surf-api-velocity-server/src/main/kotlin/dev/slne/surf/api/velocity/server/VelocityMain.kt b/surf-api-velocity/surf-api-velocity-server/src/main/kotlin/dev/slne/surf/api/velocity/server/VelocityMain.kt index d38e904c..e87baae3 100644 --- a/surf-api-velocity/surf-api-velocity-server/src/main/kotlin/dev/slne/surf/api/velocity/server/VelocityMain.kt +++ b/surf-api-velocity/surf-api-velocity-server/src/main/kotlin/dev/slne/surf/api/velocity/server/VelocityMain.kt @@ -10,6 +10,7 @@ import com.velocitypowered.api.plugin.PluginContainer import com.velocitypowered.api.plugin.annotation.DataDirectory import com.velocitypowered.api.proxy.ProxyServer import dev.slne.surf.api.core.server.CoreInstance +import dev.slne.surf.api.velocity.api.metrics.Metrics import dev.slne.surf.api.velocity.server.generated.BuildConfig import kotlinx.coroutines.runBlocking import org.slf4j.Logger @@ -30,8 +31,11 @@ class VelocityMain @Inject constructor( val pluginContainer: PluginContainer, @param:DataDirectory val dataDirectory: Path, val executorService: ExecutorService, + private val metricsFactory: Metrics.Factory ) : CoreInstance() { + lateinit var bstats: Metrics + init { instance = this @@ -45,11 +49,16 @@ class VelocityMain @Inject constructor( @Subscribe suspend fun onProxyInitialization(unused: ProxyInitializeEvent) { + bstats = metricsFactory.make(this, 29466) onEnable() } @Subscribe suspend fun onProxyShutdown(unused: ProxyShutdownEvent) { + if (::bstats.isInitialized) { + bstats.shutdown() + } + onDisable() }