Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add problem and solution for Auth server unreachable #85

Merged
merged 6 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
tomjpeg marked this conversation as resolved.
Show resolved Hide resolved
{
/**
* Get the solution as a human-readable message
*
* @return string
*/
public function getMessage(): string
{
return Translator::getInstance()->getTranslation("auth-server-solution");
}
}
Loading
Loading