Skip to content

Commit

Permalink
Merge pull request #75 from aternosorg/network-protocol-error-reports
Browse files Browse the repository at this point in the history
added network protocol error reports
  • Loading branch information
matthi4s authored Jun 17, 2024
2 parents 6d344ee + ff342d0 commit ab489e5
Show file tree
Hide file tree
Showing 29 changed files with 1,466 additions and 63 deletions.
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"type-proxy": "Proxy Log",
"type-content": "Content Log",
"type-crash-report": "Crash Report",
"type-network-protocol-error-report": "Network Protocol Error Report",
"type-unknown": "Unknown Log",
"forge-language-provider-version-problem": "The mod '{{mod-file}}' requires '{{required-version}}', but '{{found-version}}' is installed."
}
25 changes: 0 additions & 25 deletions src/Analyser/CrashReport/MinecraftCrashReportAnalyser.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Aternos\Codex\Minecraft\Analyser\CrashReport;
namespace Aternos\Codex\Minecraft\Analyser\Report\CrashReport;

use Aternos\Codex\Minecraft\Analysis\Information\Fabric\CrashReport\FabricVersionInformation;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Aternos\Codex\Minecraft\Analyser\CrashReport;
namespace Aternos\Codex\Minecraft\Analyser\Report\CrashReport;

use Aternos\Codex\Minecraft\Analysis\Information\Forge\CrashReport\ForgeVersionInformation;

Expand Down
22 changes: 22 additions & 0 deletions src/Analyser/Report/CrashReport/MinecraftCrashReportAnalyser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Aternos\Codex\Minecraft\Analyser\Report\CrashReport;

use Aternos\Codex\Minecraft\Analyser\Report\MinecraftReportAnalyser;
use Aternos\Codex\Minecraft\Analysis\Problem\CrashReport\TickingBlockEntityProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\CrashReport\TickingEntityProblem;

/**
* Class MinecraftCrashReportAnalyser
*
* @package Aternos\Codex\Minecraft\Analyser\Report\CrashReport
*/
class MinecraftCrashReportAnalyser extends MinecraftReportAnalyser
{
public function __construct()
{
parent::__construct();
$this->addPossibleInsightClass(TickingEntityProblem::class);
$this->addPossibleInsightClass(TickingBlockEntityProblem::class);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Aternos\Codex\Minecraft\Analyser\CrashReport;
namespace Aternos\Codex\Minecraft\Analyser\Report\CrashReport;

use Aternos\Codex\Minecraft\Analysis\Information\NeoForge\NeoForgeVersionInformation;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Aternos\Codex\Minecraft\Analyser\CrashReport;
namespace Aternos\Codex\Minecraft\Analyser\Report\CrashReport;

/**
* Class FabricCrashReportAnalyser
Expand Down
16 changes: 16 additions & 0 deletions src/Analyser/Report/MinecraftReportAnalyser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Aternos\Codex\Minecraft\Analyser\Report;

use Aternos\Codex\Minecraft\Analyser\MinecraftAnalyser;
use Aternos\Codex\Minecraft\Analysis\Information\CrashReport\JavaVersionInformation;
use Aternos\Codex\Minecraft\Analysis\Information\CrashReport\VanillaVersionInformation;

class MinecraftReportAnalyser extends MinecraftAnalyser
{
public function __construct()
{
$this->addPossibleInsightClass(VanillaVersionInformation::class);
$this->addPossibleInsightClass(JavaVersionInformation::class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Aternos\Codex\Minecraft\Analyser\Report\NetworkProtocolErrorReport;

use Aternos\Codex\Minecraft\Analyser\Report\MinecraftReportAnalyser;

class MinecraftNetworkProtocolErrorReportAnalyser extends MinecraftReportAnalyser
{

}
3 changes: 3 additions & 0 deletions src/Detective/Detective.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Quilt\QuiltServerLog;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaClientLog;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportLog;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaNetworkProtocolErrorReportLog;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaServerLog;
use Aternos\Codex\Minecraft\Log\Minecraft\Velocity\VelocityProxyLog;

Expand Down Expand Up @@ -96,6 +97,8 @@ class Detective extends \Aternos\Codex\Detective\Detective
MohistCrashReportLog::class,
ArclightCrashReportLog::class,

VanillaNetworkProtocolErrorReportLog::class,

PrismLauncherClientLog::class,
CustomSkinLoaderClientLog::class,
];
Expand Down
2 changes: 2 additions & 0 deletions src/Log/Minecraft/MinecraftLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Aternos\Codex\Minecraft\Log\Type\ClientLogTypeInterface;
use Aternos\Codex\Minecraft\Log\Type\ContentLogTypeInterface;
use Aternos\Codex\Minecraft\Log\Type\CrashReportLogTypeInterface;
use Aternos\Codex\Minecraft\Log\Type\NetworkProtocolErrorReportLogTypeInterface;
use Aternos\Codex\Minecraft\Log\Type\ProxyLogTypeInterface;
use Aternos\Codex\Minecraft\Log\Type\ServerLogTypeInterface;
use Aternos\Codex\Minecraft\Parser\Parser;
Expand Down Expand Up @@ -95,6 +96,7 @@ public function getTypeId(): ?string
$this instanceof ClientLogTypeInterface => "client",
$this instanceof ProxyLogTypeInterface => "proxy",
$this instanceof CrashReportLogTypeInterface => "crash-report",
$this instanceof NetworkProtocolErrorReportLogTypeInterface => "network-protocol-error-report",
$this instanceof ContentLogTypeInterface => "content",
default => null
};
Expand Down
4 changes: 2 additions & 2 deletions src/Log/Minecraft/Vanilla/Fabric/FabricCrashReportLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Minecraft\Analyser\CrashReport\FabricCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\CrashReport\MinecraftCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\FabricCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\MinecraftCrashReportAnalyser;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportTrait;
use Aternos\Codex\Minecraft\Log\Type\CrashReportLogTypeInterface;

Expand Down
4 changes: 2 additions & 2 deletions src/Log/Minecraft/Vanilla/Forge/ForgeCrashReportLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Minecraft\Analyser\CrashReport\ForgeCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\CrashReport\MinecraftCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\ForgeCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\MinecraftCrashReportAnalyser;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportTrait;
use Aternos\Codex\Minecraft\Log\Type\CrashReportLogTypeInterface;

Expand Down
4 changes: 2 additions & 2 deletions src/Log/Minecraft/Vanilla/NeoForge/NeoForgeCrashReportLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Minecraft\Analyser\CrashReport\MinecraftCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\CrashReport\NeoForgeCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\MinecraftCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\NeoForgeCrashReportAnalyser;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportTrait;
use Aternos\Codex\Minecraft\Log\Type\CrashReportLogTypeInterface;

Expand Down
5 changes: 2 additions & 3 deletions src/Log/Minecraft/Vanilla/Quilt/QuiltCrashReportLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Minecraft\Analyser\CrashReport\MinecraftCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\CrashReport\QuiltCrashReportAnalyser;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Quilt\QuiltLog;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\MinecraftCrashReportAnalyser;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\QuiltCrashReportAnalyser;
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportTrait;
use Aternos\Codex\Minecraft\Log\Type\CrashReportLogTypeInterface;

Expand Down
2 changes: 1 addition & 1 deletion src/Log/Minecraft/Vanilla/VanillaCrashReportLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* @package Aternos\Codex\Minecraft\Log\Minecraft\Vanilla
*/
class VanillaCrashReportLog extends VanillaLog implements CrashReportLogTypeInterface
class VanillaCrashReportLog extends VanillaReportLog implements CrashReportLogTypeInterface
{
use VanillaCrashReportTrait;

Expand Down
11 changes: 2 additions & 9 deletions src/Log/Minecraft/Vanilla/VanillaCrashReportTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,11 @@

namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla;

use Aternos\Codex\Minecraft\Analyser\CrashReport\MinecraftCrashReportAnalyser;
use Aternos\Codex\Minecraft\Parser\CrashReportParser;
use Aternos\Codex\Minecraft\Analyser\Report\CrashReport\MinecraftCrashReportAnalyser;

trait VanillaCrashReportTrait
{
/**
* @return CrashReportParser
*/
public static function getDefaultParser(): CrashReportParser
{
return new CrashReportParser();
}
use VanillaReportTrait;

/**
* @return MinecraftCrashReportAnalyser
Expand Down
20 changes: 20 additions & 0 deletions src/Log/Minecraft/Vanilla/VanillaNetworkProtocolErrorReportLog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla;

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Minecraft\Log\Type\NetworkProtocolErrorReportLogTypeInterface;

class VanillaNetworkProtocolErrorReportLog extends VanillaReportLog implements NetworkProtocolErrorReportLogTypeInterface
{
use VanillaNetworkProtocolErrorReportTrait;

/**
* @return DetectorInterface[]
*/
public static function getDetectors(): array
{
return [(new SinglePatternDetector())->setPattern("/---- Minecraft Network Protocol Error Report ----/")];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla;

use Aternos\Codex\Minecraft\Analyser\Report\NetworkProtocolErrorReport\MinecraftNetworkProtocolErrorReportAnalyser;

trait VanillaNetworkProtocolErrorReportTrait
{
use VanillaReportTrait;

/**
* @return MinecraftNetworkProtocolErrorReportAnalyser
*/
public static function getDefaultAnalyser(): MinecraftNetworkProtocolErrorReportAnalyser
{
return new MinecraftNetworkProtocolErrorReportAnalyser();
}
}
10 changes: 10 additions & 0 deletions src/Log/Minecraft/Vanilla/VanillaReportLog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla;

use Aternos\Codex\Minecraft\Log\Type\ReportLogTypeInterface;

class VanillaReportLog extends VanillaLog implements ReportLogTypeInterface
{

}
16 changes: 16 additions & 0 deletions src/Log/Minecraft/Vanilla/VanillaReportTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla;

use Aternos\Codex\Minecraft\Parser\ReportParser;

trait VanillaReportTrait
{
/**
* @return ReportParser
*/
public static function getDefaultParser(): ReportParser
{
return new ReportParser();
}
}
2 changes: 1 addition & 1 deletion src/Log/Type/CrashReportLogTypeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* @package Aternos\Codex\Minecraft\Log\Type
*/
interface CrashReportLogTypeInterface extends LogTypeInterface
interface CrashReportLogTypeInterface extends ReportLogTypeInterface
{

}
13 changes: 13 additions & 0 deletions src/Log/Type/NetworkProtocolErrorReportLogTypeInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Aternos\Codex\Minecraft\Log\Type;

/**
* Interface NetworkProtocolErrorReportLogTypeInterface
*
* @package Aternos\Codex\Minecraft\Log\Type
*/
interface NetworkProtocolErrorReportLogTypeInterface extends ReportLogTypeInterface
{

}
13 changes: 13 additions & 0 deletions src/Log/Type/ReportLogTypeInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Aternos\Codex\Minecraft\Log\Type;

/**
* Interface ReportLogTypeInterface
*
* @package Aternos\Codex\Minecraft\Log\Type
*/
interface ReportLogTypeInterface
{

}
22 changes: 11 additions & 11 deletions src/Parser/CrashReportLevel.php → src/Parser/ReportLevel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* @package Aternos\Codex\Minecraft\Log\CrashReport
*/
enum CrashReportLevel: int implements LevelInterface
enum ReportLevel: int implements LevelInterface
{
case WARNING = 4;
case INFO = 6;
Expand All @@ -23,11 +23,11 @@ enum CrashReportLevel: int implements LevelInterface
public static function fromString(string $level): LevelInterface
{
return match (strtolower($level)) {
"warning" => CrashReportLevel::WARNING,
"title" => CrashReportLevel::TITLE,
"comment" => CrashReportLevel::COMMENT,
"stacktrace" => CrashReportLevel::STACKTRACE,
default => CrashReportLevel::INFO
"warning" => ReportLevel::WARNING,
"title" => ReportLevel::TITLE,
"comment" => ReportLevel::COMMENT,
"stacktrace" => ReportLevel::STACKTRACE,
default => ReportLevel::INFO
};
}

Expand All @@ -37,11 +37,11 @@ public static function fromString(string $level): LevelInterface
public function asString(): string
{
return match ($this) {
CrashReportLevel::WARNING => "warning",
CrashReportLevel::TITLE => "title",
CrashReportLevel::COMMENT => "comment",
CrashReportLevel::STACKTRACE => "stacktrace",
CrashReportLevel::INFO => "info"
ReportLevel::WARNING => "warning",
ReportLevel::TITLE => "title",
ReportLevel::COMMENT => "comment",
ReportLevel::STACKTRACE => "stacktrace",
ReportLevel::INFO => "info"
};
}

Expand Down
Loading

0 comments on commit ab489e5

Please sign in to comment.