Skip to content

Commit 7fb041f

Browse files
authored
Merge pull request #97 from female-nectar/master
Add problem for missing data pack and overworld settings missing
2 parents f85d637 + aea54e3 commit 7fb041f

File tree

10 files changed

+7869
-1
lines changed

10 files changed

+7869
-1
lines changed

lang/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,7 @@
8989
"plugin-api-version-lower-than-allowed-problem": "The plugin '{{plugin-name}}' has an API version specified that is lower than the minimum allowed version.",
9090
"change-minimum-api-version-solution": "Change 'minimum-api' in bukkit.yml to {{api-version}}, lower or even 'none'.",
9191
"auth-server-problem": "The Mojang/Microsoft authentication servers are currently unreachable!",
92-
"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."
92+
"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.",
93+
"overworld-settings-missing-problem": "Overworld settings missing",
94+
"missing-datapack-mod-problem": "Datapack is missing, because the mod '{{mod-name}}' may not be installed."
9395
}

src/Analyser/ForgeAnalyser.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Aternos\Codex\Minecraft\Analysis\Information\Vanilla\VanillaVersionInformation;
99
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\FmlConfirmProblem;
1010
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\LanguageProviderVersionProblem;
11+
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\MissingDatapackModProblem;
1112
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ModDependencyProblem;
1213
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ModDuplicateProblem;
1314
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ModExceptionProblem;
@@ -43,5 +44,6 @@ public function __construct()
4344
$this->addPossibleInsightClass(PTRLibDependencyProblem::class);
4445
$this->addPossibleInsightClass(MultipleModulesExportProblem::class);
4546
$this->addPossibleInsightClass(LanguageProviderVersionProblem::class);
47+
$this->addPossibleInsightClass(MissingDatapackModProblem::class);
4648
}
4749
}

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\MalformedEncodingProblem;
88
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\OldPlayerDirectoryProblem;
9+
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\OverworldSettingsMissingProblem;
910
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\TickingBlockEntityProblem;
1011
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\AuthServerProblem;
1112

@@ -25,5 +26,6 @@ public function __construct()
2526
$this->addPossibleInsightClass(TickingBlockEntityProblem::class);
2627
$this->addPossibleInsightClass(MalformedEncodingProblem::class);
2728
$this->addPossibleInsightClass(AuthServerProblem::class);
29+
$this->addPossibleInsightClass(OverworldSettingsMissingProblem::class);
2830
}
2931
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
4+
namespace Aternos\Codex\Minecraft\Analysis\Problem\Forge;
5+
6+
use Aternos\Codex\Minecraft\Analysis\Solution\DoNothingSolution;
7+
use Aternos\Codex\Minecraft\Analysis\Solution\Forge\ModInstallSolution;
8+
use Aternos\Codex\Minecraft\Translator\Translator;
9+
10+
class MissingDatapackModProblem extends ModProblem
11+
{
12+
/**
13+
* Get a human-readable message
14+
*
15+
* @return string
16+
*/
17+
public function getMessage(): string
18+
{
19+
return Translator::getInstance()->getTranslation("missing-datapack-mod-problem", ["mod-name" => $this->getModName()]);
20+
}
21+
22+
/**
23+
* Get an array of possible patterns
24+
*
25+
* The array key of the pattern will be passed to setMatches()
26+
*
27+
* @return string[]
28+
*/
29+
public static function getPatterns(): array
30+
{
31+
return ['/Missing data pack mod:([\w\d\-]+)/'];
32+
}
33+
34+
/**
35+
* Apply the matches from the pattern
36+
*
37+
* @param array $matches
38+
* @param mixed $patternKey
39+
* @return void
40+
*/
41+
public function setMatches(array $matches, mixed $patternKey): void
42+
{
43+
$this->modName = $matches[1];
44+
$this->addSolution((new ModInstallSolution())->setModName($this->modName));
45+
$this->addSolution(new DoNothingSolution());
46+
}
47+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace Aternos\Codex\Minecraft\Analysis\Problem\Vanilla;
4+
5+
use Aternos\Codex\Minecraft\Analysis\Solution\Vanilla\GenerateNewWorldSolution;
6+
use Aternos\Codex\Minecraft\Translator\Translator;
7+
8+
class OverworldSettingsMissingProblem extends VanillaProblem
9+
{
10+
/**
11+
* Get a human-readable message
12+
*
13+
* @return string
14+
*/
15+
public function getMessage(): string
16+
{
17+
return Translator::getInstance()->getTranslation("overworld-settings-missing-problem");
18+
}
19+
20+
/**
21+
* Get an array of possible patterns
22+
*
23+
* The array key of the pattern will be passed to setMatches()
24+
*
25+
* @return string[]
26+
*/
27+
public static function getPatterns(): array
28+
{
29+
return ['/java.util.concurrent.ExecutionException: .+ Overworld settings missing/'];
30+
}
31+
32+
/**
33+
* Apply the matches from the pattern
34+
*
35+
* @param array $matches
36+
* @param mixed $patternKey
37+
* @return void
38+
*/
39+
public function setMatches(array $matches, mixed $patternKey): void
40+
{
41+
$this->addSolution(new GenerateNewWorldSolution());
42+
}
43+
}

0 commit comments

Comments
 (0)