Skip to content

Commit

Permalink
Merge pull request #78 from pavog/paper-unsupported-class-version
Browse files Browse the repository at this point in the history
Detect UnsupportedClassVersionErrors in newer versions of Paper
  • Loading branch information
matthi4s authored Jul 4, 2024
2 parents 7206b8a + f8aff60 commit 09e6ac3
Show file tree
Hide file tree
Showing 6 changed files with 768 additions and 8 deletions.
16 changes: 10 additions & 6 deletions src/Analysis/Problem/Bukkit/UnsupportedClassVersionProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Aternos\Codex\Minecraft\Analysis\Problem\Bukkit;

use Aternos\Codex\Minecraft\Analysis\Solution\Bukkit\PluginInstallDifferentVersionSolution;
use Aternos\Codex\Minecraft\Analysis\Solution\Bukkit\ServerInstallDifferentVersionSolution;
use Aternos\Codex\Minecraft\Analysis\Solution\File\FileDeleteSolution;
use Aternos\Codex\Minecraft\Analysis\Solution\UpdateJavaSolution;
use Aternos\Codex\Minecraft\Translator\Translator;
Expand Down Expand Up @@ -52,9 +50,13 @@ public function getMessage(): string
*/
public function setMatches(array $matches, mixed $patternKey): void
{
$this->pluginPath = $matches[1];
$this->pluginName = $matches[2];
$this->classFileVersion = $matches[3];
$pluginFileName = $matches[1]; // worldedit-bukkit-7.3.4-beta-01.jar
$pluginName = $matches[2]; // worldedit-bukkit-7.3.4-beta-01
$folderName = $matches[3]; // plugins

$this->pluginPath = $folderName . '/' . $pluginFileName;
$this->pluginName = $pluginName;
$this->classFileVersion = $matches[4];

$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getPluginPath()));
$this->addSolution((new UpdateJavaSolution())->setVersion($this->getJavaVersion()));
Expand All @@ -71,7 +73,9 @@ public function setMatches(array $matches, mixed $patternKey): void
public static function getPatterns(): array
{
return [
'/Could not load \'(plugins[\/\\\]((?!\.jar).*)\.jar)\' in folder \'[^\']+\''
'/Could not load \'plugins[\/\\\](((?!\.jar).*)\.jar)\' in folder \'([^\']+)\''
. '\norg\.bukkit\.plugin\.InvalidPluginException\: java\.lang\.UnsupportedClassVersionError: .+ \(class file version (\d+)\.\d+\)/',
'/Could not load plugin \'(((?!\.jar).*)\.jar)\' in folder \'([^\']+)\''
. '\norg\.bukkit\.plugin\.InvalidPluginException\: java\.lang\.UnsupportedClassVersionError: .+ \(class file version (\d+)\.\d+\)/'
];
}
Expand Down
Loading

0 comments on commit 09e6ac3

Please sign in to comment.