Skip to content

Commit

Permalink
Merge pull request #85 from aternosorg/add-auth-server-down-problem
Browse files Browse the repository at this point in the history
Add problem and solution for Auth server unreachable
  • Loading branch information
tomjpeg authored Aug 8, 2024
2 parents 44e1fa2 + d2651bb commit 7fce147
Show file tree
Hide file tree
Showing 7 changed files with 668 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 @@ -87,5 +87,7 @@
"type-unknown": "Unknown Log",
"forge-language-provider-version-problem": "The mod '{{mod-file}}' requires '{{required-version}}', but '{{found-version}}' is installed.",
"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'."
"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."
}
2 changes: 2 additions & 0 deletions src/Analyser/VanillaAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\MalformedEncodingProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\OldPlayerDirectoryProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\TickingBlockEntityProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Vanilla\AuthServerProblem;

/**
* Class VanillaAnalyser
Expand All @@ -23,5 +24,6 @@ public function __construct()
$this->addPossibleInsightClass(AquaticWorldOnOlderVersionProblem::class);
$this->addPossibleInsightClass(TickingBlockEntityProblem::class);
$this->addPossibleInsightClass(MalformedEncodingProblem::class);
$this->addPossibleInsightClass(AuthServerProblem::class);
}
}
49 changes: 49 additions & 0 deletions src/Analysis/Problem/Vanilla/AuthServerProblem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

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

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

/**
* Class AuthServerProblem
*
* @package Aternos\Codex\Minecraft\Analysis\Problem\Vanilla
*/
class AuthServerProblem extends VanillaProblem
{
/**
* Get a human-readable message
*
* @return string
*/
public function getMessage(): string
{
return Translator::getInstance()->getTranslation("auth-server-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 ['#Failed to read from https://api\.minecraftservices\.com/publickeys due to Connect#'];
}


/**
* 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 AuthServerSolution());
}
}
18 changes: 18 additions & 0 deletions src/Analysis/Solution/Vanilla/AuthServerSolution.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

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

use Aternos\Codex\Minecraft\Translator\Translator;

class AuthServerSolution extends VanillaSolution
{
/**
* Get the solution as a human-readable message
*
* @return string
*/
public function getMessage(): string
{
return Translator::getInstance()->getTranslation("auth-server-solution");
}
}
Loading

0 comments on commit 7fce147

Please sign in to comment.