Skip to content

Commit b050a50

Browse files
authored
Merge pull request #107 from aternosorg/detect-spigot-crash-reports
Add SpigotCrashReportLog to detect Spigot in crash reports
2 parents d54e606 + 5201959 commit b050a50

File tree

5 files changed

+1324
-0
lines changed

5 files changed

+1324
-0
lines changed

src/Detective/Detective.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Bukkit\Purpur\PurpurCrashReportLog;
2222
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Bukkit\Purpur\PurpurServerLog;
2323
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Bukkit\Spigot\OldSpigotServerLog;
24+
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Bukkit\Spigot\SpigotCrashReportLog;
2425
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Bukkit\Spigot\SpigotServerLog;
2526
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Fabric\FabricClientLog;
2627
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Fabric\FabricCrashReportLog;
@@ -81,6 +82,7 @@ class Detective extends \Aternos\Codex\Detective\Detective
8182
GlowstoneServerLog::class,
8283
QuiltServerLog::class,
8384

85+
SpigotCrashReportLog::class,
8486
PaperCrashReportLog::class,
8587
PurpurCrashReportLog::class,
8688
FoliaCrashReport::class,
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\Bukkit\Spigot;
4+
5+
use Aternos\Codex\Detective\DetectorInterface;
6+
use Aternos\Codex\Detective\MultiPatternDetector;
7+
use Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaCrashReportTrait;
8+
use Aternos\Codex\Minecraft\Log\Type\CrashReportLogTypeInterface;
9+
10+
class SpigotCrashReportLog extends SpigotLog implements CrashReportLogTypeInterface
11+
{
12+
use VanillaCrashReportTrait;
13+
14+
/**
15+
* @return DetectorInterface[]
16+
*/
17+
public static function getDetectors(): array
18+
{
19+
return [
20+
(new MultiPatternDetector())
21+
->addPattern("/^---- Minecraft Crash Report ----$/m")
22+
->addPattern("/^\s+Known server brands: Spigot$/m"),
23+
(new MultiPatternDetector())
24+
->addPattern("/^---- Minecraft Crash Report ----$/m")
25+
->addPattern("/^\s+Is Modded: Definitely; Server brand changed to 'Spigot'$/m")
26+
];
27+
}
28+
}

0 commit comments

Comments
 (0)