From 5124b80e3c99fc769771459fc3126b520799fad1 Mon Sep 17 00:00:00 2001 From: powercas_gamer Date: Wed, 31 Jul 2024 18:17:34 +0000 Subject: [PATCH 1/4] [ci skip] make 'runShadow' workingDir use the 'run' directory --- proxy/build.gradle.kts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/proxy/build.gradle.kts b/proxy/build.gradle.kts index 5e1387b06c..7d4b600c7e 100644 --- a/proxy/build.gradle.kts +++ b/proxy/build.gradle.kts @@ -92,6 +92,10 @@ tasks { dependsOn(configurateBuildTask) from(zipTree(configurateBuildTask.map { it.outputs.files.singleFile })) } + + runShadow { + workingDir = file("run").also(File::mkdirs) + } } dependencies { From e4d58701783526947fb3974752b94c2cff18d66e Mon Sep 17 00:00:00 2001 From: powercas_gamer Date: Wed, 31 Jul 2024 19:13:09 +0000 Subject: [PATCH 2/4] also do it for run --- proxy/build.gradle.kts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proxy/build.gradle.kts b/proxy/build.gradle.kts index 7d4b600c7e..9a5093ca55 100644 --- a/proxy/build.gradle.kts +++ b/proxy/build.gradle.kts @@ -96,6 +96,9 @@ tasks { runShadow { workingDir = file("run").also(File::mkdirs) } + named("run") { + workingDir = file("run").also(File::mkdirs) + } } dependencies { From 30cb871794bf3043692846ccdcbd015ee659d23a Mon Sep 17 00:00:00 2001 From: powercas_gamer Date: Fri, 2 Aug 2024 15:45:05 +0000 Subject: [PATCH 3/4] enable console input for runShadow doesn't work for `run` --- proxy/build.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/proxy/build.gradle.kts b/proxy/build.gradle.kts index 9a5093ca55..035ff24def 100644 --- a/proxy/build.gradle.kts +++ b/proxy/build.gradle.kts @@ -95,9 +95,11 @@ tasks { runShadow { workingDir = file("run").also(File::mkdirs) + standardInput = System.`in` } named("run") { workingDir = file("run").also(File::mkdirs) + standardInput = System.`in` // Doesn't work? } } From 6ecd49decec8f5d349c5b64898bd3ed44cc2d9ba Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sat, 14 Sep 2024 11:57:47 +0100 Subject: [PATCH 4/4] Disable metrics in unrelocated environment --- .../java/com/velocitypowered/proxy/VelocityServer.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java index 0042436169..be0c8de9b6 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/VelocityServer.java @@ -100,6 +100,7 @@ import net.kyori.adventure.translation.TranslationRegistry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.bstats.MetricsBase; import org.checkerframework.checker.nullness.qual.EnsuresNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.NonNull; @@ -263,7 +264,13 @@ void start() { this.cm.queryBind(configuration.getBind().getHostString(), configuration.getQueryPort()); } - Metrics.VelocityMetrics.startMetrics(this, configuration.getMetrics()); + final String defaultPackage = new String( + new byte[] { 'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's' }); + if (!MetricsBase.class.getPackage().getName().startsWith(defaultPackage)) { + Metrics.VelocityMetrics.startMetrics(this, configuration.getMetrics()); + } else { + logger.warn("debug environment, metrics is disabled!"); + } } private void registerTranslations() {