From ce7b80a93d79a76d1abf170ac5506dcc3fc12af6 Mon Sep 17 00:00:00 2001 From: twisti-dev <76837088+twisti-dev@users.noreply.github.com> Date: Fri, 3 Jul 2026 12:29:26 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20feat(metrics):=20add=20bStats?= =?UTF-8?q?=20metrics=20integration=20for=20Paper=20and=20Velocity=20plugi?= =?UTF-8?q?ns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - initialize bStats metrics in PaperMain and VelocityMain classes - ensure proper shutdown of metrics on plugin disable --- .../kotlin/dev/slne/surf/api/paper/server/PaperMain.kt | 9 +++++++++ .../dev/slne/surf/api/velocity/server/VelocityMain.kt | 9 +++++++++ 2 files changed, 18 insertions(+) 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 7a5a5c1cc..2de100c64 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 d38e904c7..e87baae3f 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() } From 993cf6443030380c2d2285ab3a523e9a7ca2e729 Mon Sep 17 00:00:00 2001 From: twisti-dev <76837088+twisti-dev@users.noreply.github.com> Date: Fri, 3 Jul 2026 12:30:11 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=A7=20chore:=20update=20version=20?= =?UTF-8?q?to=203.33.1=20in=20gradle.properties?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f351da1c0..08640c638 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