Skip to content

Commit

Permalink
Add problem for missing data pack and overworld settings missing
Browse files Browse the repository at this point in the history
  • Loading branch information
female-nectar committed Dec 6, 2024
1 parent f85d637 commit aea54e3
Show file tree
Hide file tree
Showing 10 changed files with 7,869 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,7 @@
"plugin-api-version-lower-than-allowed-problem": "The plugin '{{plugin-name}}' has an API version specified that is lower than the minimum allowed version.",
"change-minimum-api-version-solution": "Change 'minimum-api' in bukkit.yml to {{api-version}}, lower or even 'none'.",
"auth-server-problem": "The Mojang/Microsoft authentication servers are currently unreachable!",
"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."
"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.",
"overworld-settings-missing-problem": "Overworld settings missing",
"missing-datapack-mod-problem": "Datapack is missing, because the mod '{{mod-name}}' may not be installed."
}
2 changes: 2 additions & 0 deletions src/Analyser/ForgeAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Aternos\Codex\Minecraft\Analysis\Information\Vanilla\VanillaVersionInformation;
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\FmlConfirmProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\LanguageProviderVersionProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\MissingDatapackModProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ModDependencyProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ModDuplicateProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ModExceptionProblem;
Expand Down Expand Up @@ -43,5 +44,6 @@ public function __construct()
$this->addPossibleInsightClass(PTRLibDependencyProblem::class);
$this->addPossibleInsightClass(MultipleModulesExportProblem::class);
$this->addPossibleInsightClass(LanguageProviderVersionProblem::class);
$this->addPossibleInsightClass(MissingDatapackModProblem::class);
}
}
2 changes: 2 additions & 0 deletions src/Analyser/VanillaAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\AquaticWorldOnOlderVersionProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\MalformedEncodingProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\OldPlayerDirectoryProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\OverworldSettingsMissingProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\TickingBlockEntityProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\AuthServerProblem;

Expand All @@ -25,5 +26,6 @@ public function __construct()
$this->addPossibleInsightClass(TickingBlockEntityProblem::class);
$this->addPossibleInsightClass(MalformedEncodingProblem::class);
$this->addPossibleInsightClass(AuthServerProblem::class);
$this->addPossibleInsightClass(OverworldSettingsMissingProblem::class);
}
}
47 changes: 47 additions & 0 deletions src/Analysis/Problem/Forge/MissingDatapackModProblem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php


namespace Aternos\Codex\Minecraft\Analysis\Problem\Forge;

use Aternos\Codex\Minecraft\Analysis\Solution\DoNothingSolution;
use Aternos\Codex\Minecraft\Analysis\Solution\Forge\ModInstallSolution;
use Aternos\Codex\Minecraft\Translator\Translator;

class MissingDatapackModProblem extends ModProblem
{
/**
* Get a human-readable message
*
* @return string
*/
public function getMessage(): string
{
return Translator::getInstance()->getTranslation("missing-datapack-mod-problem", ["mod-name" => $this->getModName()]);
}

/**
* Get an array of possible patterns
*
* The array key of the pattern will be passed to setMatches()
*
* @return string[]
*/
public static function getPatterns(): array
{
return ['/Missing data pack mod:([\w\d\-]+)/'];
}

/**
* Apply the matches from the pattern
*
* @param array $matches
* @param mixed $patternKey
* @return void
*/
public function setMatches(array $matches, mixed $patternKey): void
{
$this->modName = $matches[1];
$this->addSolution((new ModInstallSolution())->setModName($this->modName));
$this->addSolution(new DoNothingSolution());
}
}
43 changes: 43 additions & 0 deletions src/Analysis/Problem/Vanilla/OverworldSettingsMissingProblem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace Aternos\Codex\Minecraft\Analysis\Problem\Vanilla;

use Aternos\Codex\Minecraft\Analysis\Solution\Vanilla\GenerateNewWorldSolution;
use Aternos\Codex\Minecraft\Translator\Translator;

class OverworldSettingsMissingProblem extends VanillaProblem
{
/**
* Get a human-readable message
*
* @return string
*/
public function getMessage(): string
{
return Translator::getInstance()->getTranslation("overworld-settings-missing-problem");
}

/**
* Get an array of possible patterns
*
* The array key of the pattern will be passed to setMatches()
*
* @return string[]
*/
public static function getPatterns(): array
{
return ['/java.util.concurrent.ExecutionException: .+ Overworld settings missing/'];
}

/**
* Apply the matches from the pattern
*
* @param array $matches
* @param mixed $patternKey
* @return void
*/
public function setMatches(array $matches, mixed $patternKey): void
{
$this->addSolution(new GenerateNewWorldSolution());
}
}
Loading

0 comments on commit aea54e3

Please sign in to comment.