From 48ddf2190fa551e34e4d0d8e741d0eeac364c37c Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Wed, 19 Nov 2025 16:42:31 +0100 Subject: [PATCH 1/9] rename FilePathType to PathType --- .../Fabric/FabricDuplicateModProblem.php | 6 +++--- .../Problem/Forge/ModDuplicateProblem.php | 6 +++--- .../Bukkit/Plugin/AuthMeShutdownSolution.php | 12 ++++++------ .../Solution/File/FileEditSolution.php | 6 +++--- src/Analysis/Solution/File/FileSolution.php | 18 +++++++++--------- .../File/{FilePathType.php => PathType.php} | 4 ++-- 6 files changed, 26 insertions(+), 26 deletions(-) rename src/Analysis/Solution/File/{FilePathType.php => PathType.php} (84%) diff --git a/src/Analysis/Problem/Fabric/FabricDuplicateModProblem.php b/src/Analysis/Problem/Fabric/FabricDuplicateModProblem.php index 617e29a..01deeb7 100644 --- a/src/Analysis/Problem/Fabric/FabricDuplicateModProblem.php +++ b/src/Analysis/Problem/Fabric/FabricDuplicateModProblem.php @@ -3,7 +3,7 @@ namespace Aternos\Codex\Minecraft\Analysis\Problem\Fabric; use Aternos\Codex\Minecraft\Analysis\Solution\File\FileDeleteSolution; -use Aternos\Codex\Minecraft\Analysis\Solution\File\FilePathType; +use Aternos\Codex\Minecraft\Analysis\Solution\File\PathType; use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaServerLog; use Aternos\Codex\Minecraft\Translator\Translator; @@ -33,6 +33,6 @@ public static function getPatterns(): array public function setMatches(array $matches, mixed $patternKey): void { $this->setModName($matches[3]); - $this->addSolution(new FileDeleteSolution($matches[4], FilePathType::ABSOLUTE)); + $this->addSolution(new FileDeleteSolution($matches[4], PathType::ABSOLUTE)); } -} \ No newline at end of file +} diff --git a/src/Analysis/Problem/Forge/ModDuplicateProblem.php b/src/Analysis/Problem/Forge/ModDuplicateProblem.php index b8975dc..5a4e4d4 100644 --- a/src/Analysis/Problem/Forge/ModDuplicateProblem.php +++ b/src/Analysis/Problem/Forge/ModDuplicateProblem.php @@ -4,7 +4,7 @@ use Aternos\Codex\Analysis\InsightInterface; use Aternos\Codex\Minecraft\Analysis\Solution\File\FileDeleteSolution; -use Aternos\Codex\Minecraft\Analysis\Solution\File\FilePathType; +use Aternos\Codex\Minecraft\Analysis\Solution\File\PathType; use Aternos\Codex\Minecraft\Translator\Translator; class ModDuplicateProblem extends ModProblem @@ -50,8 +50,8 @@ public function setMatches(array $matches, mixed $patternKey): void $this->firstModPath = $matches[2]; $this->secondModPath = $matches[3]; - $this->addSolution(new FileDeleteSolution($this->getFirstModPath(), FilePathType::ABSOLUTE)); - $this->addSolution(new FileDeleteSolution($this->getSecondModPath(), FilePathType::ABSOLUTE)); + $this->addSolution(new FileDeleteSolution($this->getFirstModPath(), PathType::ABSOLUTE)); + $this->addSolution(new FileDeleteSolution($this->getSecondModPath(), PathType::ABSOLUTE)); } /** diff --git a/src/Analysis/Solution/Bukkit/Plugin/AuthMeShutdownSolution.php b/src/Analysis/Solution/Bukkit/Plugin/AuthMeShutdownSolution.php index 6b02771..cad40a4 100644 --- a/src/Analysis/Solution/Bukkit/Plugin/AuthMeShutdownSolution.php +++ b/src/Analysis/Solution/Bukkit/Plugin/AuthMeShutdownSolution.php @@ -3,16 +3,16 @@ namespace Aternos\Codex\Minecraft\Analysis\Solution\Bukkit\Plugin; use Aternos\Codex\Minecraft\Analysis\Solution\File\FileEditSolution; -use Aternos\Codex\Minecraft\Analysis\Solution\File\FilePathType; +use Aternos\Codex\Minecraft\Analysis\Solution\File\PathType; use Aternos\Codex\Minecraft\Translator\Translator; class AuthMeShutdownSolution extends FileEditSolution { public function __construct( - string $path = 'plugins/AuthMe/config.yml', - FilePathType $type = FilePathType::RELATIVE, - string $pattern = '/^(\s+)stopServer\: true$/', - string $replacement = '$1stopServer: false' + string $path = 'plugins/AuthMe/config.yml', + PathType $type = PathType::RELATIVE, + string $pattern = '/^(\s+)stopServer\: true$/', + string $replacement = '$1stopServer: false' ) { parent::__construct($path, $type, $pattern, $replacement); @@ -25,4 +25,4 @@ public function getMessage(): string { return parent::getMessage() . " " . Translator::getInstance()->getTranslation("authme-shutdown-solution"); } -} \ No newline at end of file +} diff --git a/src/Analysis/Solution/File/FileEditSolution.php b/src/Analysis/Solution/File/FileEditSolution.php index b6ecf59..76bf7dc 100644 --- a/src/Analysis/Solution/File/FileEditSolution.php +++ b/src/Analysis/Solution/File/FileEditSolution.php @@ -11,13 +11,13 @@ class FileEditSolution extends FileSolution implements AutomatableSolutionInterf /** * @param string $path The relative path (without a starting slash) or absolute path to the file. * If the path is relative, it will be treated as relative to the Minecraft server root directory. - * @param FilePathType $type Is the path relative or absolute? + * @param PathType $type Is the path relative or absolute? * @param string $pattern The regex pattern to search for in the file content. * @param string $replacement The replacement string for the matched pattern. */ public function __construct( string $path, - FilePathType $type = FilePathType::RELATIVE, + PathType $type = PathType::RELATIVE, protected string $pattern, protected string $replacement ) @@ -79,4 +79,4 @@ public function processEdit(string $fileContent): ?string { return preg_replace($this->getPattern(), $this->getReplacement(), $fileContent); } -} \ No newline at end of file +} diff --git a/src/Analysis/Solution/File/FileSolution.php b/src/Analysis/Solution/File/FileSolution.php index e801582..32a20c5 100644 --- a/src/Analysis/Solution/File/FileSolution.php +++ b/src/Analysis/Solution/File/FileSolution.php @@ -9,11 +9,11 @@ abstract class FileSolution extends MinecraftSolution /** * @param string $path The relative path (without a starting slash) or absolute path to the file. * If the path is relative, it will be treated as relative to the Minecraft server root directory. - * @param FilePathType $type Is the path relative or absolute? + * @param PathType $type Is the path relative or absolute? */ public function __construct( protected string $path, - protected FilePathType $type = FilePathType::RELATIVE + protected PathType $type = PathType::RELATIVE ) { } @@ -28,7 +28,7 @@ public function __construct( public function setRelativePath(string $path): static { $this->path = $path; - $this->type = FilePathType::RELATIVE; + $this->type = PathType::RELATIVE; return $this; } @@ -41,7 +41,7 @@ public function setRelativePath(string $path): static public function setAbsolutePath(string $path): static { $this->path = $path; - $this->type = FilePathType::ABSOLUTE; + $this->type = PathType::ABSOLUTE; return $this; } @@ -59,9 +59,9 @@ public function getPath(): string /** * Get the type of the path (absolute or relative) * - * @return FilePathType + * @return PathType */ - public function getType(): FilePathType + public function getType(): PathType { return $this->type; } @@ -74,7 +74,7 @@ public function getType(): FilePathType */ public function isRelative(): bool { - return $this->getType() === FilePathType::RELATIVE; + return $this->getType() === PathType::RELATIVE; } /** @@ -84,6 +84,6 @@ public function isRelative(): bool */ public function isAbsolutePath(): bool { - return $this->getType() === FilePathType::ABSOLUTE; + return $this->getType() === PathType::ABSOLUTE; } -} \ No newline at end of file +} diff --git a/src/Analysis/Solution/File/FilePathType.php b/src/Analysis/Solution/File/PathType.php similarity index 84% rename from src/Analysis/Solution/File/FilePathType.php rename to src/Analysis/Solution/File/PathType.php index e4c07fb..ed5f6a6 100644 --- a/src/Analysis/Solution/File/FilePathType.php +++ b/src/Analysis/Solution/File/PathType.php @@ -2,8 +2,8 @@ namespace Aternos\Codex\Minecraft\Analysis\Solution\File; -enum FilePathType +enum PathType { case RELATIVE; case ABSOLUTE; -} \ No newline at end of file +} From b4d8a92960685796131d7a44af9fb2b5c299d384 Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Wed, 19 Nov 2025 16:43:16 +0100 Subject: [PATCH 2/9] add FolderSolution and FolderCreateSolution --- .../Solution/Folder/FolderCreateSolution.php | 17 ++++ .../Solution/Folder/FolderSolution.php | 90 +++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 src/Analysis/Solution/Folder/FolderCreateSolution.php create mode 100644 src/Analysis/Solution/Folder/FolderSolution.php diff --git a/src/Analysis/Solution/Folder/FolderCreateSolution.php b/src/Analysis/Solution/Folder/FolderCreateSolution.php new file mode 100644 index 0000000..d8093e6 --- /dev/null +++ b/src/Analysis/Solution/Folder/FolderCreateSolution.php @@ -0,0 +1,17 @@ +getTranslation("folder-create-solution", ["folder-path" => $this->getPath()]); + } +} diff --git a/src/Analysis/Solution/Folder/FolderSolution.php b/src/Analysis/Solution/Folder/FolderSolution.php new file mode 100644 index 0000000..1d89595 --- /dev/null +++ b/src/Analysis/Solution/Folder/FolderSolution.php @@ -0,0 +1,90 @@ +path = $path; + $this->type = PathType::RELATIVE; + return $this; + } + + /** + * Set the absolute path + * + * @param string $path + * @return $this + */ + public function setAbsolutePath(string $path): static + { + $this->path = $path; + $this->type = PathType::ABSOLUTE; + return $this; + } + + /** + * Get the path + * If isRelative() the path is relative to the Minecraft server root directory without a starting slash + * + * @return string + */ + public function getPath(): string + { + return $this->path; + } + + /** + * Get the type of the path (absolute or relative) + * + * @return PathType + */ + public function getType(): PathType + { + return $this->type; + } + + /** + * Check if the path is relative + * The path is relative to the Minecraft server root directory without a starting slash + * + * @return bool + */ + public function isRelative(): bool + { + return $this->getType() === PathType::RELATIVE; + } + + /** + * Check if the path is absolute + * + * @return bool + */ + public function isAbsolutePath(): bool + { + return $this->getType() === PathType::ABSOLUTE; + } +} From 7e3a5cd2a4828e6a5b37fb41d51bf7b21836be48 Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Wed, 19 Nov 2025 16:43:37 +0100 Subject: [PATCH 3/9] add CodeOfConductFolderMissingProblem --- .../CodeOfConductFolderMissingProblem.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/Analysis/Problem/Vanilla/CodeOfConductFolderMissingProblem.php diff --git a/src/Analysis/Problem/Vanilla/CodeOfConductFolderMissingProblem.php b/src/Analysis/Problem/Vanilla/CodeOfConductFolderMissingProblem.php new file mode 100644 index 0000000..8a4f18a --- /dev/null +++ b/src/Analysis/Problem/Vanilla/CodeOfConductFolderMissingProblem.php @@ -0,0 +1,37 @@ +getTranslation("code-of-conduct-folder-missing-problem"); + } + + /** + * @inheritDoc + */ + public static function getPatterns(): array + { + return [ + '/Failed to start the minecraft server\njava\.lang\.IllegalArgumentException\: Code of Conduct folder does not exist: (.*)$/' + ]; + } + + /** + * @inheritDoc + */ + public function setMatches(array $matches, mixed $patternKey): void + { + // usually "codeofconduct" + $folder = $matches[1]; + $this->addSolution(new FolderCreateSolution($folder)); + } +} From 55cdfc2ea559033afb4f5db16b39b9f05dd76a5f Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Wed, 19 Nov 2025 16:43:44 +0100 Subject: [PATCH 4/9] add translations --- lang/en.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lang/en.json b/lang/en.json index 284b352..a1a05b4 100644 --- a/lang/en.json +++ b/lang/en.json @@ -41,6 +41,7 @@ "plugin-remove-solution": "Remove the plugin '{{plugin-name}}'.", "file-delete-solution": "Delete the file '{{file-path}}'.", "file-edit-solution": "Edit the file '{{file-path}}'.", + "folder-create-solution": "Create the folder '{{folder-path}}'.", "mod-install-different-version-solution": "Install a different version of the mod '{{mod-name}}'.", "mod-install-solution": "Install the mod '{{mod-name}}'.", "mod-install-solution-with-version": "Install the mod '{{mod-name}}' with version {{mod-version}}.", @@ -59,6 +60,7 @@ "forge-install-different-version-solution": "Install a different Forge version.", "malformed-encoding-problem": "Something (probably the MOTD) contains malformed formatting codes.", "change-motd-solution": "Change the server MOTD.", + "code-of-conduct-folder-missing-problem": "The Code of Conduct folder does not exist.", "bedrock-authentication-whitelist-problem": "Using a whitelist without online authentication is not allowed.", "bedrock-authentication-allowlist-problem": "Using an allowlist without online authentication is not allowed.", "disable-whitelist-solution": "Disable the whitelist.", From 2215abfe89326d188242269e352fc92f267b1858 Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Wed, 19 Nov 2025 16:44:05 +0100 Subject: [PATCH 5/9] add CodeOfConductFolderMissingProblem to VanillaAnalyser --- src/Analyser/VanillaAnalyser.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Analyser/VanillaAnalyser.php b/src/Analyser/VanillaAnalyser.php index 3c341b8..3c75e02 100644 --- a/src/Analyser/VanillaAnalyser.php +++ b/src/Analyser/VanillaAnalyser.php @@ -5,6 +5,7 @@ use Aternos\Codex\Minecraft\Analysis\Information\Vanilla\VanillaVersionInformation; use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\AquaticWorldOnOlderVersionProblem; use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\AuthServerProblem; +use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\CodeOfConductFolderMissingProblem; use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\MalformedEncodingProblem; use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\OldPlayerDirectoryProblem; use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\OverworldSettingsMissingProblem; @@ -14,13 +15,13 @@ class VanillaAnalyser extends MinecraftAnalyser { public function __construct() { - $this->addPossibleInsightClass(VanillaVersionInformation::class); - - $this->addPossibleInsightClass(OldPlayerDirectoryProblem::class); $this->addPossibleInsightClass(AquaticWorldOnOlderVersionProblem::class); - $this->addPossibleInsightClass(TickingBlockEntityProblem::class); - $this->addPossibleInsightClass(MalformedEncodingProblem::class); $this->addPossibleInsightClass(AuthServerProblem::class); + $this->addPossibleInsightClass(CodeOfConductFolderMissingProblem::class); + $this->addPossibleInsightClass(MalformedEncodingProblem::class); + $this->addPossibleInsightClass(OldPlayerDirectoryProblem::class); $this->addPossibleInsightClass(OverworldSettingsMissingProblem::class); + $this->addPossibleInsightClass(TickingBlockEntityProblem::class); + $this->addPossibleInsightClass(VanillaVersionInformation::class); } -} \ No newline at end of file +} From aff85c558e6b5f0bf87282690167ab0467af3dcd Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Wed, 19 Nov 2025 16:44:20 +0100 Subject: [PATCH 6/9] add test file: vanilla-code-of-conduct --- .../data/Vanilla/vanilla-code-of-conduct.json | 287 ++++++++++++++++++ test/data/Vanilla/vanilla-code-of-conduct.log | 28 ++ test/tests/Logs/AutoLogsTest.php | 10 + 3 files changed, 325 insertions(+) create mode 100644 test/data/Vanilla/vanilla-code-of-conduct.json create mode 100644 test/data/Vanilla/vanilla-code-of-conduct.log diff --git a/test/data/Vanilla/vanilla-code-of-conduct.json b/test/data/Vanilla/vanilla-code-of-conduct.json new file mode 100644 index 0000000..f5f83e5 --- /dev/null +++ b/test/data/Vanilla/vanilla-code-of-conduct.json @@ -0,0 +1,287 @@ +{ + "id": "vanilla\/server", + "name": "Vanilla", + "type": "Server Log", + "version": "1.10.2", + "title": "Vanilla 1.10.2 Server Log", + "entries": [ + { + "level": 6, + "time": null, + "prefix": "[16:20:04] [Server thread\/INFO]:", + "lines": [ + { + "number": 1, + "content": "[16:20:04] [Server thread\/INFO]: Starting minecraft server version 1.10.2" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:21:57] [Server thread\/INFO]:", + "lines": [ + { + "number": 2, + "content": "[16:21:57] [Server thread\/INFO]: Loading properties" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:21:57] [Server thread\/INFO]:", + "lines": [ + { + "number": 3, + "content": "[16:21:57] [Server thread\/INFO]: Default game type: SURVIVAL" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:21:57] [Server thread\/INFO]:", + "lines": [ + { + "number": 4, + "content": "[16:21:57] [Server thread\/INFO]: Generating keypair" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:21:57] [Server thread\/INFO]:", + "lines": [ + { + "number": 5, + "content": "[16:21:57] [Server thread\/INFO]: Starting Minecraft server on *:10272" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:21:57] [Server thread\/INFO]:", + "lines": [ + { + "number": 6, + "content": "[16:21:57] [Server thread\/INFO]: Using epoll channel type" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:22:34] [Server thread\/INFO]:", + "lines": [ + { + "number": 7, + "content": "[16:22:34] [Server thread\/INFO]: Preparing level \"world\"" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:22:39] [Server thread\/INFO]:", + "lines": [ + { + "number": 8, + "content": "[16:22:39] [Server thread\/INFO]: Preparing start region for level 0" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:22:41] [Server thread\/INFO]:", + "lines": [ + { + "number": 9, + "content": "[16:22:41] [Server thread\/INFO]: Preparing spawn area: 0%" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:22:42] [Server thread\/INFO]:", + "lines": [ + { + "number": 10, + "content": "[16:22:42] [Server thread\/INFO]: Preparing spawn area: 8%" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:22:43] [Server thread\/INFO]:", + "lines": [ + { + "number": 11, + "content": "[16:22:43] [Server thread\/INFO]: Preparing spawn area: 23%" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:22:44] [Server thread\/INFO]:", + "lines": [ + { + "number": 12, + "content": "[16:22:44] [Server thread\/INFO]: Preparing spawn area: 37%" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:22:45] [Server thread\/INFO]:", + "lines": [ + { + "number": 13, + "content": "[16:22:45] [Server thread\/INFO]: Preparing spawn area: 56%" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:22:46] [Server thread\/INFO]:", + "lines": [ + { + "number": 14, + "content": "[16:22:46] [Server thread\/INFO]: Preparing spawn area: 71%" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:22:47] [Server thread\/INFO]:", + "lines": [ + { + "number": 15, + "content": "[16:22:47] [Server thread\/INFO]: Preparing spawn area: 87%" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:22:48] [Server thread\/INFO]:", + "lines": [ + { + "number": 16, + "content": "[16:22:48] [Server thread\/INFO]: Preparing spawn area: 98%" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:22:48] [Server thread\/INFO]:", + "lines": [ + { + "number": 17, + "content": "[16:22:48] [Server thread\/INFO]: Done (14.532s)! For help, type \"help\" or \"?\"" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:22:48] [Server thread\/INFO]:", + "lines": [ + { + "number": 18, + "content": "[16:22:48] [Server thread\/INFO]: Starting GS4 status listener" + } + ] + }, + { + "level": 6, + "time": null, + "prefix": "[16:22:48] [Query Listener #1\/INFO]:", + "lines": [ + { + "number": 19, + "content": "[16:22:48] [Query Listener #1\/INFO]: Query running on **.**.**.**:10272" + } + ] + }, + { + "level": 3, + "time": null, + "prefix": "[14:20:41] [ServerMain\/ERROR]:", + "lines": [ + { + "number": 20, + "content": "[14:20:41] [ServerMain\/ERROR]: Failed to start the minecraft server" + }, + { + "number": 21, + "content": "java.lang.IllegalArgumentException: Code of Conduct folder does not exist: codeofconduct" + }, + { + "number": 22, + "content": "\tat aro.bU(SourceFile:119) ~[server-1.21.10.jar:?]" + }, + { + "number": 23, + "content": "\tat aro.(SourceFile:110) ~[server-1.21.10.jar:?]" + }, + { + "number": 24, + "content": "\tat net.minecraft.server.Main.a(SourceFile:221) ~[server-1.21.10.jar:?]" + }, + { + "number": 25, + "content": "\tat net.minecraft.server.MinecraftServer.a(SourceFile:304) ~[server-1.21.10.jar:?]" + }, + { + "number": 26, + "content": "\tat net.minecraft.server.Main.main(SourceFile:220) ~[server-1.21.10.jar:?]" + }, + { + "number": 27, + "content": "\tat net.minecraft.bundler.Main.lambda$run$0(Main.java:54) ~[?:?]" + }, + { + "number": 28, + "content": "\tat java.base\/java.lang.Thread.run(Thread.java:1583) [?:?]" + }, + { + "number": 29, + "content": "" + } + ] + } + ], + "analysis": { + "problems": [], + "information": [ + { + "message": "Minecraft version: 1.10.2", + "counter": 1, + "entry": { + "level": 6, + "time": null, + "prefix": "[16:20:04] [Server thread\/INFO]:", + "lines": [ + { + "number": 1, + "content": "[16:20:04] [Server thread\/INFO]: Starting minecraft server version 1.10.2" + } + ] + }, + "label": "Minecraft version", + "value": "1.10.2" + } + ] + } +} \ No newline at end of file diff --git a/test/data/Vanilla/vanilla-code-of-conduct.log b/test/data/Vanilla/vanilla-code-of-conduct.log new file mode 100644 index 0000000..7ead800 --- /dev/null +++ b/test/data/Vanilla/vanilla-code-of-conduct.log @@ -0,0 +1,28 @@ +[16:20:04] [Server thread/INFO]: Starting minecraft server version 1.10.2 +[16:21:57] [Server thread/INFO]: Loading properties +[16:21:57] [Server thread/INFO]: Default game type: SURVIVAL +[16:21:57] [Server thread/INFO]: Generating keypair +[16:21:57] [Server thread/INFO]: Starting Minecraft server on *:10272 +[16:21:57] [Server thread/INFO]: Using epoll channel type +[16:22:34] [Server thread/INFO]: Preparing level "world" +[16:22:39] [Server thread/INFO]: Preparing start region for level 0 +[16:22:41] [Server thread/INFO]: Preparing spawn area: 0% +[16:22:42] [Server thread/INFO]: Preparing spawn area: 8% +[16:22:43] [Server thread/INFO]: Preparing spawn area: 23% +[16:22:44] [Server thread/INFO]: Preparing spawn area: 37% +[16:22:45] [Server thread/INFO]: Preparing spawn area: 56% +[16:22:46] [Server thread/INFO]: Preparing spawn area: 71% +[16:22:47] [Server thread/INFO]: Preparing spawn area: 87% +[16:22:48] [Server thread/INFO]: Preparing spawn area: 98% +[16:22:48] [Server thread/INFO]: Done (14.532s)! For help, type "help" or "?" +[16:22:48] [Server thread/INFO]: Starting GS4 status listener +[16:22:48] [Query Listener #1/INFO]: Query running on **.**.**.**:10272 +[14:20:41] [ServerMain/ERROR]: Failed to start the minecraft server +java.lang.IllegalArgumentException: Code of Conduct folder does not exist: codeofconduct + at aro.bU(SourceFile:119) ~[server-1.21.10.jar:?] + at aro.(SourceFile:110) ~[server-1.21.10.jar:?] + at net.minecraft.server.Main.a(SourceFile:221) ~[server-1.21.10.jar:?] + at net.minecraft.server.MinecraftServer.a(SourceFile:304) ~[server-1.21.10.jar:?] + at net.minecraft.server.Main.main(SourceFile:220) ~[server-1.21.10.jar:?] + at net.minecraft.bundler.Main.lambda$run$0(Main.java:54) ~[?:?] + at java.base/java.lang.Thread.run(Thread.java:1583) [?:?] diff --git a/test/tests/Logs/AutoLogsTest.php b/test/tests/Logs/AutoLogsTest.php index 22aef32..f748e23 100644 --- a/test/tests/Logs/AutoLogsTest.php +++ b/test/tests/Logs/AutoLogsTest.php @@ -1754,6 +1754,16 @@ public function test_vanilla_client_1_19_2(): void $this->assertStringEqualsFile($log->getExpectedPath(), $log->getOutput(), $log->getLogPath()); } + /** + * @return void + * @throws Exception + */ + public function test_vanilla_code_of_conduct(): void + { + $log = new TestLog('Vanilla/vanilla-code-of-conduct.log'); + $this->assertStringEqualsFile($log->getExpectedPath(), $log->getOutput(), $log->getLogPath()); + } + /** * @return void * @throws Exception From f5cd0a7190a1afc7daba71681777a85d644fa4c3 Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Wed, 19 Nov 2025 16:49:06 +0100 Subject: [PATCH 7/9] update test file: vanilla-code-of-conduct --- .../data/Vanilla/vanilla-code-of-conduct.json | 232 ++---------------- test/data/Vanilla/vanilla-code-of-conduct.log | 22 +- 2 files changed, 22 insertions(+), 232 deletions(-) diff --git a/test/data/Vanilla/vanilla-code-of-conduct.json b/test/data/Vanilla/vanilla-code-of-conduct.json index f5f83e5..da8bb38 100644 --- a/test/data/Vanilla/vanilla-code-of-conduct.json +++ b/test/data/Vanilla/vanilla-code-of-conduct.json @@ -2,215 +2,39 @@ "id": "vanilla\/server", "name": "Vanilla", "type": "Server Log", - "version": "1.10.2", - "title": "Vanilla 1.10.2 Server Log", + "version": null, + "title": "Vanilla Server Log", "entries": [ { "level": 6, "time": null, - "prefix": "[16:20:04] [Server thread\/INFO]:", + "prefix": "[14:20:38] [ServerMain\/INFO]:", "lines": [ { "number": 1, - "content": "[16:20:04] [Server thread\/INFO]: Starting minecraft server version 1.10.2" + "content": "[14:20:38] [ServerMain\/INFO]: Environment: Environment[sessionHost=https:\/\/sessionserver.mojang.com, servicesHost=https:\/\/api.minecraftservices.com, profilesHost=https:\/\/api.mojang.com, name=PROD]" } ] }, { "level": 6, "time": null, - "prefix": "[16:21:57] [Server thread\/INFO]:", + "prefix": "[14:20:41] [ServerMain\/INFO]:", "lines": [ { "number": 2, - "content": "[16:21:57] [Server thread\/INFO]: Loading properties" + "content": "[14:20:41] [ServerMain\/INFO]: Loaded 1461 recipes" } ] }, { "level": 6, "time": null, - "prefix": "[16:21:57] [Server thread\/INFO]:", + "prefix": "[14:20:41] [ServerMain\/INFO]:", "lines": [ { "number": 3, - "content": "[16:21:57] [Server thread\/INFO]: Default game type: SURVIVAL" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:21:57] [Server thread\/INFO]:", - "lines": [ - { - "number": 4, - "content": "[16:21:57] [Server thread\/INFO]: Generating keypair" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:21:57] [Server thread\/INFO]:", - "lines": [ - { - "number": 5, - "content": "[16:21:57] [Server thread\/INFO]: Starting Minecraft server on *:10272" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:21:57] [Server thread\/INFO]:", - "lines": [ - { - "number": 6, - "content": "[16:21:57] [Server thread\/INFO]: Using epoll channel type" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:22:34] [Server thread\/INFO]:", - "lines": [ - { - "number": 7, - "content": "[16:22:34] [Server thread\/INFO]: Preparing level \"world\"" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:22:39] [Server thread\/INFO]:", - "lines": [ - { - "number": 8, - "content": "[16:22:39] [Server thread\/INFO]: Preparing start region for level 0" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:22:41] [Server thread\/INFO]:", - "lines": [ - { - "number": 9, - "content": "[16:22:41] [Server thread\/INFO]: Preparing spawn area: 0%" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:22:42] [Server thread\/INFO]:", - "lines": [ - { - "number": 10, - "content": "[16:22:42] [Server thread\/INFO]: Preparing spawn area: 8%" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:22:43] [Server thread\/INFO]:", - "lines": [ - { - "number": 11, - "content": "[16:22:43] [Server thread\/INFO]: Preparing spawn area: 23%" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:22:44] [Server thread\/INFO]:", - "lines": [ - { - "number": 12, - "content": "[16:22:44] [Server thread\/INFO]: Preparing spawn area: 37%" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:22:45] [Server thread\/INFO]:", - "lines": [ - { - "number": 13, - "content": "[16:22:45] [Server thread\/INFO]: Preparing spawn area: 56%" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:22:46] [Server thread\/INFO]:", - "lines": [ - { - "number": 14, - "content": "[16:22:46] [Server thread\/INFO]: Preparing spawn area: 71%" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:22:47] [Server thread\/INFO]:", - "lines": [ - { - "number": 15, - "content": "[16:22:47] [Server thread\/INFO]: Preparing spawn area: 87%" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:22:48] [Server thread\/INFO]:", - "lines": [ - { - "number": 16, - "content": "[16:22:48] [Server thread\/INFO]: Preparing spawn area: 98%" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:22:48] [Server thread\/INFO]:", - "lines": [ - { - "number": 17, - "content": "[16:22:48] [Server thread\/INFO]: Done (14.532s)! For help, type \"help\" or \"?\"" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:22:48] [Server thread\/INFO]:", - "lines": [ - { - "number": 18, - "content": "[16:22:48] [Server thread\/INFO]: Starting GS4 status listener" - } - ] - }, - { - "level": 6, - "time": null, - "prefix": "[16:22:48] [Query Listener #1\/INFO]:", - "lines": [ - { - "number": 19, - "content": "[16:22:48] [Query Listener #1\/INFO]: Query running on **.**.**.**:10272" + "content": "[14:20:41] [ServerMain\/INFO]: Loaded 1574 advancements" } ] }, @@ -220,43 +44,43 @@ "prefix": "[14:20:41] [ServerMain\/ERROR]:", "lines": [ { - "number": 20, + "number": 4, "content": "[14:20:41] [ServerMain\/ERROR]: Failed to start the minecraft server" }, { - "number": 21, + "number": 5, "content": "java.lang.IllegalArgumentException: Code of Conduct folder does not exist: codeofconduct" }, { - "number": 22, + "number": 6, "content": "\tat aro.bU(SourceFile:119) ~[server-1.21.10.jar:?]" }, { - "number": 23, + "number": 7, "content": "\tat aro.(SourceFile:110) ~[server-1.21.10.jar:?]" }, { - "number": 24, + "number": 8, "content": "\tat net.minecraft.server.Main.a(SourceFile:221) ~[server-1.21.10.jar:?]" }, { - "number": 25, + "number": 9, "content": "\tat net.minecraft.server.MinecraftServer.a(SourceFile:304) ~[server-1.21.10.jar:?]" }, { - "number": 26, + "number": 10, "content": "\tat net.minecraft.server.Main.main(SourceFile:220) ~[server-1.21.10.jar:?]" }, { - "number": 27, + "number": 11, "content": "\tat net.minecraft.bundler.Main.lambda$run$0(Main.java:54) ~[?:?]" }, { - "number": 28, + "number": 12, "content": "\tat java.base\/java.lang.Thread.run(Thread.java:1583) [?:?]" }, { - "number": 29, + "number": 13, "content": "" } ] @@ -264,24 +88,6 @@ ], "analysis": { "problems": [], - "information": [ - { - "message": "Minecraft version: 1.10.2", - "counter": 1, - "entry": { - "level": 6, - "time": null, - "prefix": "[16:20:04] [Server thread\/INFO]:", - "lines": [ - { - "number": 1, - "content": "[16:20:04] [Server thread\/INFO]: Starting minecraft server version 1.10.2" - } - ] - }, - "label": "Minecraft version", - "value": "1.10.2" - } - ] + "information": [] } } \ No newline at end of file diff --git a/test/data/Vanilla/vanilla-code-of-conduct.log b/test/data/Vanilla/vanilla-code-of-conduct.log index 7ead800..dd8a61e 100644 --- a/test/data/Vanilla/vanilla-code-of-conduct.log +++ b/test/data/Vanilla/vanilla-code-of-conduct.log @@ -1,22 +1,6 @@ -[16:20:04] [Server thread/INFO]: Starting minecraft server version 1.10.2 -[16:21:57] [Server thread/INFO]: Loading properties -[16:21:57] [Server thread/INFO]: Default game type: SURVIVAL -[16:21:57] [Server thread/INFO]: Generating keypair -[16:21:57] [Server thread/INFO]: Starting Minecraft server on *:10272 -[16:21:57] [Server thread/INFO]: Using epoll channel type -[16:22:34] [Server thread/INFO]: Preparing level "world" -[16:22:39] [Server thread/INFO]: Preparing start region for level 0 -[16:22:41] [Server thread/INFO]: Preparing spawn area: 0% -[16:22:42] [Server thread/INFO]: Preparing spawn area: 8% -[16:22:43] [Server thread/INFO]: Preparing spawn area: 23% -[16:22:44] [Server thread/INFO]: Preparing spawn area: 37% -[16:22:45] [Server thread/INFO]: Preparing spawn area: 56% -[16:22:46] [Server thread/INFO]: Preparing spawn area: 71% -[16:22:47] [Server thread/INFO]: Preparing spawn area: 87% -[16:22:48] [Server thread/INFO]: Preparing spawn area: 98% -[16:22:48] [Server thread/INFO]: Done (14.532s)! For help, type "help" or "?" -[16:22:48] [Server thread/INFO]: Starting GS4 status listener -[16:22:48] [Query Listener #1/INFO]: Query running on **.**.**.**:10272 +[14:20:38] [ServerMain/INFO]: Environment: Environment[sessionHost=https://sessionserver.mojang.com, servicesHost=https://api.minecraftservices.com, profilesHost=https://api.mojang.com, name=PROD] +[14:20:41] [ServerMain/INFO]: Loaded 1461 recipes +[14:20:41] [ServerMain/INFO]: Loaded 1574 advancements [14:20:41] [ServerMain/ERROR]: Failed to start the minecraft server java.lang.IllegalArgumentException: Code of Conduct folder does not exist: codeofconduct at aro.bU(SourceFile:119) ~[server-1.21.10.jar:?] From 84998a39c9dc59ab947bb2b0c1ed1d6b4c1bc614 Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Wed, 19 Nov 2025 16:51:10 +0100 Subject: [PATCH 8/9] remove end of string token ($) from regex, update test results --- .../CodeOfConductFolderMissingProblem.php | 2 +- .../data/Vanilla/vanilla-code-of-conduct.json | 59 ++++++++++++++++++- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/src/Analysis/Problem/Vanilla/CodeOfConductFolderMissingProblem.php b/src/Analysis/Problem/Vanilla/CodeOfConductFolderMissingProblem.php index 8a4f18a..8c5b0a9 100644 --- a/src/Analysis/Problem/Vanilla/CodeOfConductFolderMissingProblem.php +++ b/src/Analysis/Problem/Vanilla/CodeOfConductFolderMissingProblem.php @@ -21,7 +21,7 @@ public function getMessage(): string public static function getPatterns(): array { return [ - '/Failed to start the minecraft server\njava\.lang\.IllegalArgumentException\: Code of Conduct folder does not exist: (.*)$/' + '/Failed to start the minecraft server\njava\.lang\.IllegalArgumentException\: Code of Conduct folder does not exist: (.*)/' ]; } diff --git a/test/data/Vanilla/vanilla-code-of-conduct.json b/test/data/Vanilla/vanilla-code-of-conduct.json index da8bb38..ef186ef 100644 --- a/test/data/Vanilla/vanilla-code-of-conduct.json +++ b/test/data/Vanilla/vanilla-code-of-conduct.json @@ -87,7 +87,64 @@ } ], "analysis": { - "problems": [], + "problems": [ + { + "message": "The Code of Conduct folder does not exist.", + "counter": 1, + "entry": { + "level": 3, + "time": null, + "prefix": "[14:20:41] [ServerMain\/ERROR]:", + "lines": [ + { + "number": 4, + "content": "[14:20:41] [ServerMain\/ERROR]: Failed to start the minecraft server" + }, + { + "number": 5, + "content": "java.lang.IllegalArgumentException: Code of Conduct folder does not exist: codeofconduct" + }, + { + "number": 6, + "content": "\tat aro.bU(SourceFile:119) ~[server-1.21.10.jar:?]" + }, + { + "number": 7, + "content": "\tat aro.(SourceFile:110) ~[server-1.21.10.jar:?]" + }, + { + "number": 8, + "content": "\tat net.minecraft.server.Main.a(SourceFile:221) ~[server-1.21.10.jar:?]" + }, + { + "number": 9, + "content": "\tat net.minecraft.server.MinecraftServer.a(SourceFile:304) ~[server-1.21.10.jar:?]" + }, + { + "number": 10, + "content": "\tat net.minecraft.server.Main.main(SourceFile:220) ~[server-1.21.10.jar:?]" + }, + { + "number": 11, + "content": "\tat net.minecraft.bundler.Main.lambda$run$0(Main.java:54) ~[?:?]" + }, + { + "number": 12, + "content": "\tat java.base\/java.lang.Thread.run(Thread.java:1583) [?:?]" + }, + { + "number": 13, + "content": "" + } + ] + }, + "solutions": [ + { + "message": "Create the folder 'codeofconduct'." + } + ] + } + ], "information": [] } } \ No newline at end of file From 505ab39636a17b2d72160a22812c81d33eca1cfd Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Wed, 19 Nov 2025 17:21:13 +0100 Subject: [PATCH 9/9] revert: rename FilePathType to PathType --- .../Fabric/FabricDuplicateModProblem.php | 4 ++-- .../Problem/Forge/ModDuplicateProblem.php | 6 +++--- .../Bukkit/Plugin/AuthMeShutdownSolution.php | 10 +++++----- .../Solution/File/FileEditSolution.php | 4 ++-- .../File/{PathType.php => FilePathType.php} | 2 +- src/Analysis/Solution/File/FileSolution.php | 16 ++++++++-------- .../Solution/Folder/FolderSolution.php | 18 +++++++++--------- 7 files changed, 30 insertions(+), 30 deletions(-) rename src/Analysis/Solution/File/{PathType.php => FilePathType.php} (85%) diff --git a/src/Analysis/Problem/Fabric/FabricDuplicateModProblem.php b/src/Analysis/Problem/Fabric/FabricDuplicateModProblem.php index 01deeb7..7e052aa 100644 --- a/src/Analysis/Problem/Fabric/FabricDuplicateModProblem.php +++ b/src/Analysis/Problem/Fabric/FabricDuplicateModProblem.php @@ -3,7 +3,7 @@ namespace Aternos\Codex\Minecraft\Analysis\Problem\Fabric; use Aternos\Codex\Minecraft\Analysis\Solution\File\FileDeleteSolution; -use Aternos\Codex\Minecraft\Analysis\Solution\File\PathType; +use Aternos\Codex\Minecraft\Analysis\Solution\File\FilePathType; use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaServerLog; use Aternos\Codex\Minecraft\Translator\Translator; @@ -33,6 +33,6 @@ public static function getPatterns(): array public function setMatches(array $matches, mixed $patternKey): void { $this->setModName($matches[3]); - $this->addSolution(new FileDeleteSolution($matches[4], PathType::ABSOLUTE)); + $this->addSolution(new FileDeleteSolution($matches[4], FilePathType::ABSOLUTE)); } } diff --git a/src/Analysis/Problem/Forge/ModDuplicateProblem.php b/src/Analysis/Problem/Forge/ModDuplicateProblem.php index 5a4e4d4..b8975dc 100644 --- a/src/Analysis/Problem/Forge/ModDuplicateProblem.php +++ b/src/Analysis/Problem/Forge/ModDuplicateProblem.php @@ -4,7 +4,7 @@ use Aternos\Codex\Analysis\InsightInterface; use Aternos\Codex\Minecraft\Analysis\Solution\File\FileDeleteSolution; -use Aternos\Codex\Minecraft\Analysis\Solution\File\PathType; +use Aternos\Codex\Minecraft\Analysis\Solution\File\FilePathType; use Aternos\Codex\Minecraft\Translator\Translator; class ModDuplicateProblem extends ModProblem @@ -50,8 +50,8 @@ public function setMatches(array $matches, mixed $patternKey): void $this->firstModPath = $matches[2]; $this->secondModPath = $matches[3]; - $this->addSolution(new FileDeleteSolution($this->getFirstModPath(), PathType::ABSOLUTE)); - $this->addSolution(new FileDeleteSolution($this->getSecondModPath(), PathType::ABSOLUTE)); + $this->addSolution(new FileDeleteSolution($this->getFirstModPath(), FilePathType::ABSOLUTE)); + $this->addSolution(new FileDeleteSolution($this->getSecondModPath(), FilePathType::ABSOLUTE)); } /** diff --git a/src/Analysis/Solution/Bukkit/Plugin/AuthMeShutdownSolution.php b/src/Analysis/Solution/Bukkit/Plugin/AuthMeShutdownSolution.php index cad40a4..490171f 100644 --- a/src/Analysis/Solution/Bukkit/Plugin/AuthMeShutdownSolution.php +++ b/src/Analysis/Solution/Bukkit/Plugin/AuthMeShutdownSolution.php @@ -3,16 +3,16 @@ namespace Aternos\Codex\Minecraft\Analysis\Solution\Bukkit\Plugin; use Aternos\Codex\Minecraft\Analysis\Solution\File\FileEditSolution; -use Aternos\Codex\Minecraft\Analysis\Solution\File\PathType; +use Aternos\Codex\Minecraft\Analysis\Solution\File\FilePathType; use Aternos\Codex\Minecraft\Translator\Translator; class AuthMeShutdownSolution extends FileEditSolution { public function __construct( - string $path = 'plugins/AuthMe/config.yml', - PathType $type = PathType::RELATIVE, - string $pattern = '/^(\s+)stopServer\: true$/', - string $replacement = '$1stopServer: false' + string $path = 'plugins/AuthMe/config.yml', + FilePathType $type = FilePathType::RELATIVE, + string $pattern = '/^(\s+)stopServer\: true$/', + string $replacement = '$1stopServer: false' ) { parent::__construct($path, $type, $pattern, $replacement); diff --git a/src/Analysis/Solution/File/FileEditSolution.php b/src/Analysis/Solution/File/FileEditSolution.php index 76bf7dc..e579c35 100644 --- a/src/Analysis/Solution/File/FileEditSolution.php +++ b/src/Analysis/Solution/File/FileEditSolution.php @@ -11,13 +11,13 @@ class FileEditSolution extends FileSolution implements AutomatableSolutionInterf /** * @param string $path The relative path (without a starting slash) or absolute path to the file. * If the path is relative, it will be treated as relative to the Minecraft server root directory. - * @param PathType $type Is the path relative or absolute? + * @param FilePathType $type Is the path relative or absolute? * @param string $pattern The regex pattern to search for in the file content. * @param string $replacement The replacement string for the matched pattern. */ public function __construct( string $path, - PathType $type = PathType::RELATIVE, + FilePathType $type = FilePathType::RELATIVE, protected string $pattern, protected string $replacement ) diff --git a/src/Analysis/Solution/File/PathType.php b/src/Analysis/Solution/File/FilePathType.php similarity index 85% rename from src/Analysis/Solution/File/PathType.php rename to src/Analysis/Solution/File/FilePathType.php index ed5f6a6..8e6a4f0 100644 --- a/src/Analysis/Solution/File/PathType.php +++ b/src/Analysis/Solution/File/FilePathType.php @@ -2,7 +2,7 @@ namespace Aternos\Codex\Minecraft\Analysis\Solution\File; -enum PathType +enum FilePathType { case RELATIVE; case ABSOLUTE; diff --git a/src/Analysis/Solution/File/FileSolution.php b/src/Analysis/Solution/File/FileSolution.php index 32a20c5..ee33d49 100644 --- a/src/Analysis/Solution/File/FileSolution.php +++ b/src/Analysis/Solution/File/FileSolution.php @@ -9,11 +9,11 @@ abstract class FileSolution extends MinecraftSolution /** * @param string $path The relative path (without a starting slash) or absolute path to the file. * If the path is relative, it will be treated as relative to the Minecraft server root directory. - * @param PathType $type Is the path relative or absolute? + * @param FilePathType $type Is the path relative or absolute? */ public function __construct( protected string $path, - protected PathType $type = PathType::RELATIVE + protected FilePathType $type = FilePathType::RELATIVE ) { } @@ -28,7 +28,7 @@ public function __construct( public function setRelativePath(string $path): static { $this->path = $path; - $this->type = PathType::RELATIVE; + $this->type = FilePathType::RELATIVE; return $this; } @@ -41,7 +41,7 @@ public function setRelativePath(string $path): static public function setAbsolutePath(string $path): static { $this->path = $path; - $this->type = PathType::ABSOLUTE; + $this->type = FilePathType::ABSOLUTE; return $this; } @@ -59,9 +59,9 @@ public function getPath(): string /** * Get the type of the path (absolute or relative) * - * @return PathType + * @return FilePathType */ - public function getType(): PathType + public function getType(): FilePathType { return $this->type; } @@ -74,7 +74,7 @@ public function getType(): PathType */ public function isRelative(): bool { - return $this->getType() === PathType::RELATIVE; + return $this->getType() === FilePathType::RELATIVE; } /** @@ -84,6 +84,6 @@ public function isRelative(): bool */ public function isAbsolutePath(): bool { - return $this->getType() === PathType::ABSOLUTE; + return $this->getType() === FilePathType::ABSOLUTE; } } diff --git a/src/Analysis/Solution/Folder/FolderSolution.php b/src/Analysis/Solution/Folder/FolderSolution.php index 1d89595..e6803c9 100644 --- a/src/Analysis/Solution/Folder/FolderSolution.php +++ b/src/Analysis/Solution/Folder/FolderSolution.php @@ -2,7 +2,7 @@ namespace Aternos\Codex\Minecraft\Analysis\Solution\Folder; -use Aternos\Codex\Minecraft\Analysis\Solution\File\PathType; +use Aternos\Codex\Minecraft\Analysis\Solution\File\FilePathType; use Aternos\Codex\Minecraft\Analysis\Solution\MinecraftSolution; abstract class FolderSolution extends MinecraftSolution @@ -10,11 +10,11 @@ abstract class FolderSolution extends MinecraftSolution /** * @param string $path The relative path (without a starting slash) or absolute path to the folder. * If the path is relative, it will be treated as relative to the Minecraft server root directory. - * @param PathType $type Is the path relative or absolute? + * @param FilePathType $type Is the path relative or absolute? */ public function __construct( protected string $path, - protected PathType $type = PathType::RELATIVE + protected FilePathType $type = FilePathType::RELATIVE ) { } @@ -29,7 +29,7 @@ public function __construct( public function setRelativePath(string $path): static { $this->path = $path; - $this->type = PathType::RELATIVE; + $this->type = FilePathType::RELATIVE; return $this; } @@ -42,7 +42,7 @@ public function setRelativePath(string $path): static public function setAbsolutePath(string $path): static { $this->path = $path; - $this->type = PathType::ABSOLUTE; + $this->type = FilePathType::ABSOLUTE; return $this; } @@ -60,9 +60,9 @@ public function getPath(): string /** * Get the type of the path (absolute or relative) * - * @return PathType + * @return FilePathType */ - public function getType(): PathType + public function getType(): FilePathType { return $this->type; } @@ -75,7 +75,7 @@ public function getType(): PathType */ public function isRelative(): bool { - return $this->getType() === PathType::RELATIVE; + return $this->getType() === FilePathType::RELATIVE; } /** @@ -85,6 +85,6 @@ public function isRelative(): bool */ public function isAbsolutePath(): bool { - return $this->getType() === PathType::ABSOLUTE; + return $this->getType() === FilePathType::ABSOLUTE; } }