Skip to content

Commit

Permalink
Merge pull request #47 from aternosorg/custom-skin-loader-version-fix
Browse files Browse the repository at this point in the history
detect snapshot versions of custom skin loader
  • Loading branch information
JulianVennen authored Feb 9, 2023
2 parents cf9727b + 96e6fb5 commit 59bf4a0
Show file tree
Hide file tree
Showing 7 changed files with 669 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

class CustomSkinLoaderVersionInformation extends CustomSkinLoaderInformation
{
protected static string $versionPattern = "[\d.]+(?:-SNAPSHOT(?:-\d+)?)?";

public function __construct()
{
$this->label = Translator::getInstance()->getTranslation("custom-skin-loader-version");
Expand All @@ -21,6 +23,14 @@ public function __construct()
*/
public static function getPatterns(): array
{
return [ '/^' . CustomSkinLoaderLog::getPrefixPattern() . 'CustomSkinLoader ([\d.]+)$/'];
return [ '/^' . CustomSkinLoaderLog::getPrefixPattern() . 'CustomSkinLoader ('. static::$versionPattern .')$/'];
}

/**
* @return string
*/
public static function getVersionPattern(): string
{
return static::$versionPattern;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Aternos\Codex\Detective\DetectorInterface;
use Aternos\Codex\Detective\SinglePatternDetector;
use Aternos\Codex\Minecraft\Analysis\Information\CustomSkinLoader\CustomSkinLoaderVersionInformation;
use Aternos\Codex\Minecraft\Log\Type\ClientLogTypeInterface;

class CustomSkinLoaderClientLog extends CustomSkinLoaderLog implements ClientLogTypeInterface
Expand All @@ -13,6 +14,8 @@ class CustomSkinLoaderClientLog extends CustomSkinLoaderLog implements ClientLog
*/
public static function getDetectors(): array
{
return [(new SinglePatternDetector())->setPattern("/^\[\d{4}(?:\-\d\d){2} (?:[0-9]{2}\:?){3}\] \[Render thread INFO\] CustomSkinLoader [\d\.]+$/m")];
return [(new SinglePatternDetector())
->setPattern("/^\[\d{4}(?:\-\d\d){2} (?:[0-9]{2}\:?){3}\] \[Render thread INFO\] CustomSkinLoader "
. CustomSkinLoaderVersionInformation::getVersionPattern() . "$/m")];
}
}
2 changes: 2 additions & 0 deletions src/Log/Minecraft/CustomSkinLoader/CustomSkinLoaderLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Aternos\Codex\Analyser\AnalyserInterface;
use Aternos\Codex\Minecraft\Analyser\CustomSkinLoaderAnalyser;
use Aternos\Codex\Minecraft\Analysis\Information\CustomSkinLoader\CustomSkinLoaderVersionInformation;
use Aternos\Codex\Minecraft\Parser\Parser;

/**
Expand All @@ -15,6 +16,7 @@ abstract class CustomSkinLoaderLog extends \Aternos\Codex\Minecraft\Log\Minecraf
{
protected static string $prefixPattern = '\[\d{4}(?:\-\d\d){2} (?:[0-9]{2}\:?){3}\] \[[^\]]+ [A-Z]+\] ';
protected static string $pattern = '/^(\[(\d{4}(?:\-\d\d){2} (?:[0-9]{2}\:?){3})\] \[[^\]]+ ([A-Z]+)\]) .*$/';
protected static ?string $versionInformationClass = CustomSkinLoaderVersionInformation::class;

/**
* @return Parser
Expand Down
Loading

0 comments on commit 59bf4a0

Please sign in to comment.