Gracefully handle errors loading plugin manifest

this isn't perfect, but it covers the common cases.
Now, the server won't spam crashdumps just because some plugin declared nested permissions.
This commit is contained in:
Dylan K. Taylor
2021-10-05 20:28:43 +01:00
parent 7245d15abe
commit e25c03eec1
5 changed files with 25 additions and 5 deletions

View File

@ -1746,6 +1746,12 @@ final class KnownTranslationFactory{
]);
}
public static function pocketmine_plugin_invalidManifest(Translatable|string $details) : Translatable{
return new Translatable(KnownTranslationKeys::POCKETMINE_PLUGIN_INVALIDMANIFEST, [
"details" => $details,
]);
}
public static function pocketmine_plugin_load(Translatable|string $param0) : Translatable{
return new Translatable(KnownTranslationKeys::POCKETMINE_PLUGIN_LOAD, [
0 => $param0,

View File

@ -364,6 +364,7 @@ final class KnownTranslationKeys{
public const POCKETMINE_PLUGIN_INCOMPATIBLEPHPVERSION = "pocketmine.plugin.incompatiblePhpVersion";
public const POCKETMINE_PLUGIN_INCOMPATIBLEPROTOCOL = "pocketmine.plugin.incompatibleProtocol";
public const POCKETMINE_PLUGIN_INVALIDAPI = "pocketmine.plugin.invalidAPI";
public const POCKETMINE_PLUGIN_INVALIDMANIFEST = "pocketmine.plugin.invalidManifest";
public const POCKETMINE_PLUGIN_LOAD = "pocketmine.plugin.load";
public const POCKETMINE_PLUGIN_LOADERROR = "pocketmine.plugin.loadError";
public const POCKETMINE_PLUGIN_RESTRICTEDNAME = "pocketmine.plugin.restrictedName";