From d8eb493545e6f7bdd703f79c44f3235f135a812b Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Fri, 13 Nov 2026 20:54:52 +0100 Subject: [PATCH 1/2] start server jar path only after a colon --- .../Problem/Paper/ServerJarInPluginFolderProblem.php | 5 ++++- test/tests/Performance/PatternSafetyTest.php | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Analysis/Problem/Paper/ServerJarInPluginFolderProblem.php b/src/Analysis/Problem/Paper/ServerJarInPluginFolderProblem.php index 2da448ab..88e06fc2 100644 --- a/src/Analysis/Problem/Paper/ServerJarInPluginFolderProblem.php +++ b/src/Analysis/Problem/Paper/ServerJarInPluginFolderProblem.php @@ -26,13 +26,16 @@ public function getMessage(): string } /** + * Example: "Error loading plugin: plugins/server.jar appears to be a server jar! Server jars do not belong in the plugin folder." + * * @inheritDoc */ public static function getPatterns(): array { return [ // the path is either relative (plugins/server.jar) or absolute (/srv/plugins/server.jar, C:\server\plugins\server.jar) - '/((?:[a-zA-Z]:)?[^\s:][^\n:]*?\.jar) appears to be a server jar! Server jars do not belong in the plugin folder\./' + // it always follows ": ", starting it anywhere else makes the pattern scan the rest of the line from every position + '/(?<=: )((?:[a-zA-Z]:)?[^\s:][^\n:]*?\.jar) appears to be a server jar! Server jars do not belong in the plugin folder\./' ]; } diff --git a/test/tests/Performance/PatternSafetyTest.php b/test/tests/Performance/PatternSafetyTest.php index 8832e356..c7f65503 100644 --- a/test/tests/Performance/PatternSafetyTest.php +++ b/test/tests/Performance/PatternSafetyTest.php @@ -7,7 +7,6 @@ use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ClientOnlyModProblem; use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ModDependencyProblem; use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ModFatalProblem; -use Aternos\Codex\Minecraft\Analysis\Problem\Paper\ServerJarInPluginFolderProblem; use Aternos\Codex\Minecraft\Test\Logs\TestLog; use FilesystemIterator; use Generator; @@ -80,7 +79,6 @@ class PatternSafetyTest extends TestCase ClientOnlyModProblem::class => [0], ModDependencyProblem::class => ["loading-failed-exception"], ModFatalProblem::class => ["failed-to-load"], - ServerJarInPluginFolderProblem::class => [0], ]; /** From c17cc346ec5a95551a8f26f267ceef622b467794 Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Fri, 13 Nov 2026 22:22:47 +0100 Subject: [PATCH 2/2] remove server jar pattern from known unsafe patterns again --- test/tests/Performance/PatternSafetyTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/tests/Performance/PatternSafetyTest.php b/test/tests/Performance/PatternSafetyTest.php index a60234e2..6bde897e 100644 --- a/test/tests/Performance/PatternSafetyTest.php +++ b/test/tests/Performance/PatternSafetyTest.php @@ -5,7 +5,6 @@ use Aternos\Codex\Analysis\PatternInsightInterface; use Aternos\Codex\Minecraft\Analysis\Problem\Bukkit\ChunkLoadExceptionProblem; use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ModDependencyProblem; -use Aternos\Codex\Minecraft\Analysis\Problem\Paper\ServerJarInPluginFolderProblem; use Aternos\Codex\Minecraft\Test\Logs\TestLog; use FilesystemIterator; use Generator; @@ -76,7 +75,6 @@ class PatternSafetyTest extends TestCase protected const array KNOWN_UNSAFE_PATTERNS = [ ChunkLoadExceptionProblem::class => [0, 1, 2], ModDependencyProblem::class => ["loading-failed-exception"], - ServerJarInPluginFolderProblem::class => [0], ]; /**