-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from KurtThiemann/master
Detect Mod File needs language provider problem
- Loading branch information
Showing
8 changed files
with
1,887 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/Analysis/Problem/Forge/LanguageProviderVersionProblem.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace Aternos\Codex\Minecraft\Analysis\Problem\Forge; | ||
|
||
use Aternos\Codex\Minecraft\Analysis\Solution\Forge\ForgeInstallDifferentVersionSolution; | ||
use Aternos\Codex\Minecraft\Analysis\Solution\Forge\ModRemoveSolution; | ||
use Aternos\Codex\Minecraft\Translator\Translator; | ||
|
||
class LanguageProviderVersionProblem extends ModProblem | ||
{ | ||
protected string $languageProvider = ""; | ||
protected string $requiredVersion = ""; | ||
protected string $foundVersion = ""; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getMessage(): string | ||
{ | ||
$provider = $this->languageProvider; | ||
if ($provider === "javafml") { | ||
$provider = "Forge"; | ||
} | ||
return Translator::getInstance()->getTranslation("forge-language-provider-version-problem", | ||
[ | ||
"mod-file" => $this->getModName(), | ||
"required-version" => $provider . " " . $this->requiredVersion, | ||
"found-version" => $this->foundVersion | ||
]); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public static function getPatterns(): array | ||
{ | ||
return [ | ||
"/Mod File ([^\/\n]+) needs language provider ([\w-]+):(.*?) to load[\n\s§\da-f]*We have found (\d+)/" | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function setMatches(array $matches, mixed $patternKey): void | ||
{ | ||
$this->modName = $matches[1]; | ||
$this->languageProvider = $matches[2]; | ||
$this->requiredVersion = $matches[3]; | ||
$this->foundVersion = $matches[4]; | ||
|
||
$this->addSolution((new ModRemoveSolution())->setModName($this->getModName())); | ||
$this->addSolution((new ForgeInstallDifferentVersionSolution())); | ||
} | ||
} |
Oops, something went wrong.