-
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 #44 from aternosorg/custom-skin-loader
Add support for logs by CustomSkinLoader
- Loading branch information
Showing
12 changed files
with
1,025 additions
and
197 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Aternos\Codex\Minecraft\Analyser; | ||
|
||
use Aternos\Codex\Minecraft\Analysis\Information\CustomSkinLoader\CustomSkinLoaderJavaVersionInformation; | ||
use Aternos\Codex\Minecraft\Analysis\Information\CustomSkinLoader\CustomSkinLoaderMinecraftVersionInformation; | ||
use Aternos\Codex\Minecraft\Analysis\Information\CustomSkinLoader\CustomSkinLoaderVersionInformation; | ||
|
||
class CustomSkinLoaderAnalyser extends MinecraftAnalyser | ||
{ | ||
public function __construct() | ||
{ | ||
$this->addPossibleInsightClass(CustomSkinLoaderVersionInformation::class); | ||
$this->addPossibleInsightClass(CustomSkinLoaderJavaVersionInformation::class); | ||
$this->addPossibleInsightClass(CustomSkinLoaderMinecraftVersionInformation::class); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Analysis/Information/CustomSkinLoader/CustomSkinLoaderInformation.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,10 @@ | ||
<?php | ||
|
||
namespace Aternos\Codex\Minecraft\Analysis\Information\CustomSkinLoader; | ||
|
||
use Aternos\Codex\Minecraft\Analysis\Information\MinecraftInformation; | ||
|
||
abstract class CustomSkinLoaderInformation extends MinecraftInformation | ||
{ | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
src/Analysis/Information/CustomSkinLoader/CustomSkinLoaderJavaVersionInformation.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,27 @@ | ||
<?php | ||
|
||
namespace Aternos\Codex\Minecraft\Analysis\Information\CustomSkinLoader; | ||
|
||
use Aternos\Codex\Minecraft\Analysis\Information\Vanilla\VanillaVersionInformation; | ||
use Aternos\Codex\Minecraft\Log\Minecraft\CustomSkinLoader\CustomSkinLoaderLog; | ||
use Aternos\Codex\Minecraft\Translator\Translator; | ||
|
||
class CustomSkinLoaderJavaVersionInformation extends CustomSkinLoaderInformation | ||
{ | ||
public function __construct() | ||
{ | ||
$this->label = Translator::getInstance()->getTranslation("java-version"); | ||
} | ||
|
||
/** | ||
* 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 [ '/^' . CustomSkinLoaderLog::getPrefixPattern() . 'Java Version: ([0-9\.]+(?:_\d+)?)/']; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Analysis/Information/CustomSkinLoader/CustomSkinLoaderMinecraftVersionInformation.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,27 @@ | ||
<?php | ||
|
||
namespace Aternos\Codex\Minecraft\Analysis\Information\CustomSkinLoader; | ||
|
||
use Aternos\Codex\Minecraft\Analysis\Information\Vanilla\VanillaVersionInformation; | ||
use Aternos\Codex\Minecraft\Log\Minecraft\CustomSkinLoader\CustomSkinLoaderLog; | ||
use Aternos\Codex\Minecraft\Translator\Translator; | ||
|
||
class CustomSkinLoaderMinecraftVersionInformation extends CustomSkinLoaderInformation | ||
{ | ||
public function __construct() | ||
{ | ||
$this->label = Translator::getInstance()->getTranslation("minecraft-version"); | ||
} | ||
|
||
/** | ||
* 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 [ '/^' . CustomSkinLoaderLog::getPrefixPattern() . 'Minecraft: (' . VanillaVersionInformation::getVersionPattern() . ')$/']; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/Analysis/Information/CustomSkinLoader/CustomSkinLoaderVersionInformation.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,26 @@ | ||
<?php | ||
|
||
namespace Aternos\Codex\Minecraft\Analysis\Information\CustomSkinLoader; | ||
|
||
use Aternos\Codex\Minecraft\Log\Minecraft\CustomSkinLoader\CustomSkinLoaderLog; | ||
use Aternos\Codex\Minecraft\Translator\Translator; | ||
|
||
class CustomSkinLoaderVersionInformation extends CustomSkinLoaderInformation | ||
{ | ||
public function __construct() | ||
{ | ||
$this->label = Translator::getInstance()->getTranslation("custom-skin-loader-version"); | ||
} | ||
|
||
/** | ||
* 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 [ '/^' . CustomSkinLoaderLog::getPrefixPattern() . 'CustomSkinLoader ([\d.]+)$/']; | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
src/Log/Minecraft/CustomSkinLoader/CustomSkinLoaderClientLog.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,18 @@ | ||
<?php | ||
|
||
namespace Aternos\Codex\Minecraft\Log\Minecraft\CustomSkinLoader; | ||
|
||
use Aternos\Codex\Detective\DetectorInterface; | ||
use Aternos\Codex\Detective\SinglePatternDetector; | ||
use Aternos\Codex\Minecraft\Log\Type\ClientLogTypeInterface; | ||
|
||
class CustomSkinLoaderClientLog extends CustomSkinLoaderLog implements ClientLogTypeInterface | ||
{ | ||
/** | ||
* @return DetectorInterface[] | ||
*/ | ||
public static function getDetectors(): array | ||
{ | ||
return [(new SinglePatternDetector())->setPattern("/^\[\d{4}(?:\-\d\d){2} (?:[0-9]{2}\:?){3}\] \[Render thread INFO\] CustomSkinLoader [\d\.]+$/m")]; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/Log/Minecraft/CustomSkinLoader/CustomSkinLoaderLog.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,50 @@ | ||
<?php | ||
|
||
namespace Aternos\Codex\Minecraft\Log\Minecraft\CustomSkinLoader; | ||
|
||
use Aternos\Codex\Analyser\AnalyserInterface; | ||
use Aternos\Codex\Minecraft\Analyser\CustomSkinLoaderAnalyser; | ||
use Aternos\Codex\Minecraft\Parser\Parser; | ||
|
||
/** | ||
* Class CustomSkinLoaderLog | ||
* | ||
* @package Aternos\Codex\Minecraft\Log\Minecraft\CustomSkinLoader | ||
*/ | ||
abstract class CustomSkinLoaderLog extends \Aternos\Codex\Minecraft\Log\Minecraft\MinecraftLog | ||
{ | ||
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]+)\]) .*$/'; | ||
|
||
/** | ||
* @return Parser | ||
*/ | ||
public static function getDefaultParser(): Parser | ||
{ | ||
return (new Parser()) | ||
->setPattern(static::$pattern) | ||
->setTimeFormat('Y-m-d H:i:s') | ||
->setMatches([Parser::PREFIX, Parser::TIME, Parser::LEVEL]);; | ||
} | ||
|
||
public static function getDefaultAnalyser(): AnalyserInterface | ||
{ | ||
return new CustomSkinLoaderAnalyser(); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName(): string | ||
{ | ||
return "Custom Skin Loader"; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public static function getPrefixPattern(): string | ||
{ | ||
return static::$prefixPattern; | ||
} | ||
} |
Oops, something went wrong.