Skip to content

Commit 06b0ce2

Browse files
committed
detect problem when parsing of datapack fails
1 parent 0adcde5 commit 06b0ce2

6 files changed

Lines changed: 14696 additions & 1 deletion

File tree

lang/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,6 @@
9393
"auth-server-problem": "The Mojang/Microsoft authentication servers are currently unreachable!",
9494
"auth-server-solution": "Wait a few minutes and try again. If the issue persists, check the official Mojang/Microsoft channels for any known authentication server problems.",
9595
"overworld-settings-missing-problem": "Overworld settings missing",
96-
"missing-datapack-mod-problem": "Datapack is missing, because the mod '{{mod-name}}' may not be installed."
96+
"missing-datapack-mod-problem": "Datapack is missing, because the mod '{{mod-name}}' may not be installed.",
97+
"datapack-parsing-problem": "The datapack '{{datapack}}' could not be parsed."
9798
}

src/Analyser/VanillaAnalyser.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\AquaticWorldOnOlderVersionProblem;
77
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\AuthServerProblem;
88
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\CodeOfConductFolderMissingProblem;
9+
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\DatapackParsingProblem;
910
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\MalformedEncodingProblem;
1011
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\OldPlayerDirectoryProblem;
1112
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\OverworldSettingsMissingProblem;
@@ -18,6 +19,7 @@ public function __construct()
1819
$this->addPossibleInsightClass(AquaticWorldOnOlderVersionProblem::class);
1920
$this->addPossibleInsightClass(AuthServerProblem::class);
2021
$this->addPossibleInsightClass(CodeOfConductFolderMissingProblem::class);
22+
$this->addPossibleInsightClass(DatapackParsingProblem::class);
2123
$this->addPossibleInsightClass(MalformedEncodingProblem::class);
2224
$this->addPossibleInsightClass(OldPlayerDirectoryProblem::class);
2325
$this->addPossibleInsightClass(OverworldSettingsMissingProblem::class);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace Aternos\Codex\Minecraft\Analysis\Problem\Vanilla;
4+
5+
use Aternos\Codex\Minecraft\Analysis\Solution\File\FileDeleteSolution;
6+
use Aternos\Codex\Minecraft\Translator\Translator;
7+
8+
class DatapackParsingProblem extends VanillaProblem
9+
{
10+
protected string $datapack;
11+
12+
/**
13+
* @inheritDoc
14+
*/
15+
public function getMessage(): string
16+
{
17+
return Translator::getInstance()->getTranslation("datapack-parsing-problem");
18+
}
19+
20+
/**
21+
* @inheritDoc
22+
*/
23+
public static function getPatterns(): array
24+
{
25+
return ['/java.lang.IllegalStateException: Failed to parse .+ from pack file\/(.*)/'];
26+
}
27+
28+
/**
29+
* @inheritDoc
30+
*/
31+
public function setMatches(array $matches, mixed $patternKey): void
32+
{
33+
$this->datapack = $matches[1];
34+
$this->addSolution(new FileDeleteSolution($this->datapack));
35+
}
36+
}

0 commit comments

Comments
 (0)