Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"mod-incompatible-problem": "The mods '{{first-mod-name}}' and '{{second-mod-name}}' are incompatible.",
"server-install-different-version-solution": "Install the version '{{software-version}}' of your server software.",
"plugin-api-version-problem": "The plugin '{{plugin-name}}' needs version '{{software-version}}' of your server software.",
"legacy-plugin-conversion-problem": "The legacy plugin '{{plugin-name}}' could not be converted for this server version.",
"plugin-java-version-problem": "The plugin '{{plugin-name}}' requires Java version {{java-version}} or later to run.",
"change-java-version-solution": "Change your Java version to {{java-version}} or later.",
"ticking-entity-problem": "The entity '{{name}}' at the location {{location}} is causing issues while ticking.",
Expand Down
2 changes: 2 additions & 0 deletions src/Analyser/BukkitAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Aternos\Codex\Analysis\PatternInsightInterface;
use Aternos\Codex\Minecraft\Analysis\Problem\Bukkit\AmbiguousPluginNameProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Bukkit\ChunkLoadExceptionProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Bukkit\LegacyPluginConversionProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Bukkit\Plugin\AuthMeShutdownProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Bukkit\Plugin\MultiverseLoadProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Bukkit\Plugin\PermissionsExConfigProblem;
Expand Down Expand Up @@ -42,6 +43,7 @@ public static function getInsightClasses(): array
PluginDependenciesProblem::class,
UnsupportedApiVersionProblem::class,
UnsupportedClassVersionProblem::class,
LegacyPluginConversionProblem::class,
];
}

Expand Down
40 changes: 40 additions & 0 deletions src/Analysis/Problem/Bukkit/LegacyPluginConversionProblem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

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

use Aternos\Codex\Minecraft\Translator\Translator;

/**
* CraftBukkit could not convert a class of a legacy plugin (a plugin without an api-version in its plugin.yml).
*
* The server rewrites the classes of legacy plugins while loading them, so they work with the current API.
* When that fails, the class is loaded unchanged and the plugin usually breaks as soon as it uses it.
* Only a version of the plugin that is made for the current server version helps.
* The problem is reported once per plugin, even if several of its classes fail.
*/
class LegacyPluginConversionProblem extends PluginProblem
{
/**
* @inheritDoc
*/
public function getMessage(): string
{
return Translator::getInstance()->getTranslation("legacy-plugin-conversion-problem", [
"plugin-name" => $this->getPluginName()
]);
}

/**
* The plugin is logged with its full name, that is the name and the version with a "v" in front,
* followed by the path of the class in the plugin jar.
* Example: `Fatal error trying to convert LegacyBrokenClass v1.0:com/repro/BrokenClass.class`
*
* The plugin name is the first group, so {@see PluginProblem::setMatches()} reads it as `$matches[1]`.
*
* @inheritDoc
*/
public static function getPatterns(): array
{
return ['/Fatal error trying to convert (?<plugin>' . PluginProblem::PLUGIN_NAME . ') v[^:\n]+:\S+\.class/'];
}
}
Loading
Loading