-
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 #22 from aternosorg/bukkit-dependencies
Add additional bukkit dependency error
- Loading branch information
Showing
16 changed files
with
2,544 additions
and
10 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
134 changes: 134 additions & 0 deletions
134
src/Analysis/Problem/Bukkit/PluginDependenciesProblem.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,134 @@ | ||
<?php | ||
|
||
namespace Aternos\Codex\Minecraft\Analysis\Problem\Bukkit; | ||
|
||
use Aternos\Codex\Minecraft\Analysis\Solution\Bukkit\PluginInstallSolution; | ||
use Aternos\Codex\Minecraft\Analysis\Solution\File\FileDeleteSolution; | ||
use Aternos\Codex\Minecraft\Translator\Translator; | ||
|
||
/** | ||
* Class PluginDependencyProblem | ||
* | ||
* @package Aternos\Codex\Minecraft\Analysis\Problem\Bukkit | ||
*/ | ||
class PluginDependenciesProblem extends BukkitProblem | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $pluginPath; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $pluginName; | ||
|
||
/** | ||
* @var string[] | ||
*/ | ||
protected $dependencyPluginNames; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getPluginPath(): string | ||
{ | ||
return $this->pluginPath; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getPluginName() | ||
{ | ||
return $this->pluginName; | ||
} | ||
|
||
/** | ||
* get a list of missing dependencies | ||
* @return string[] | ||
*/ | ||
public function getDependencyPlugins(): array | ||
{ | ||
return $this->dependencyPluginNames; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDependencyPluginNames(): string | ||
{ | ||
$result = []; | ||
foreach ($this->dependencyPluginNames as $name) { | ||
$result[] = "'". $name ."'"; | ||
} | ||
return implode(", ", $result); | ||
} | ||
|
||
/** | ||
* Get a human readable message | ||
* | ||
* @return string | ||
*/ | ||
public function getMessage(): string | ||
{ | ||
if (count($this->getDependencyPlugins()) === 1) { | ||
return Translator::getInstance()->getTranslation("plugin-dependency-problem", [ | ||
"plugin-name" => $this->getPluginName(), | ||
"dependency-plugin-name" => $this->getDependencyPlugins()[0] | ||
]); | ||
} | ||
|
||
return Translator::getInstance()->getTranslation("plugin-dependencies-problem", [ | ||
"plugin-name" => $this->getPluginName(), | ||
"dependency-plugin-names" => $this->getDependencyPluginNames() | ||
]); | ||
} | ||
|
||
/** | ||
* Get an array of possible patterns | ||
* | ||
* The array key of the pattern will be passed to setMatches() | ||
* | ||
* @return array | ||
*/ | ||
public static function getPatterns(): array | ||
{ | ||
return ['/Could not load \'(plugins[\/\\\]((?!\.jar).*)\.jar)\' in folder \'[^\']+\'\norg\.bukkit\.plugin\.UnknownDependencyException\: Unknown\/missing dependency plugins: \[([\w ,]+)\]/']; | ||
} | ||
|
||
/** | ||
* Apply the matches from the pattern | ||
* | ||
* @param array $matches | ||
* @param $patternKey | ||
*/ | ||
public function setMatches(array $matches, $patternKey): void | ||
{ | ||
$this->pluginPath = $matches[1]; | ||
$this->pluginName = $matches[2]; | ||
$this->dependencyPluginNames = preg_split("/, ?/", $matches[3]); | ||
|
||
foreach ($this->dependencyPluginNames as $name) { | ||
$this->addSolution((new PluginInstallSolution())->setPluginName($name)); | ||
} | ||
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getPluginPath())); | ||
} | ||
|
||
/** | ||
* @param static $insight | ||
* @return bool | ||
*/ | ||
public function isEqual($insight): bool | ||
{ | ||
if ($this->getPluginName() !== $insight->getPluginName() || $this->getPluginPath() !== $insight->getPluginPath()) { | ||
return false; | ||
} | ||
|
||
$dependencies = $insight->getDependencyPlugins(); | ||
sort($dependencies); | ||
$ownDependencies = $this->getDependencyPlugins(); | ||
sort($ownDependencies); | ||
return $dependencies === $ownDependencies; | ||
} | ||
} |
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,36 @@ | ||
[14:22:43] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD' | ||
[14:22:45] [Worker-Main-1/INFO]: Loaded 7 recipes | ||
[14:22:46] [Server thread/INFO]: Starting minecraft server version 1.18.2 | ||
[14:22:46] [Server thread/INFO]: Loading properties | ||
[14:22:46] [Server thread/INFO]: This server is running Paper version git-Paper-333 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT) (Git: 9fd870d) | ||
[14:22:46] [Server thread/INFO]: Server Ping Player Sample Count: 12 | ||
[14:22:46] [Server thread/INFO]: Using 4 threads for Netty based IO | ||
[14:22:46] [Server thread/INFO]: Default game type: SURVIVAL | ||
[14:22:46] [Server thread/INFO]: Generating keypair | ||
[14:22:46] [Server thread/INFO]: Starting Minecraft server on *:23728 | ||
[14:22:46] [Server thread/INFO]: Using epoll channel type | ||
[14:22:46] [Server thread/INFO]: Paper: Using libdeflate (Linux x86_64) compression from Velocity. | ||
[14:22:46] [Server thread/INFO]: Paper: Using OpenSSL 1.1.x (Linux x86_64) cipher from Velocity. | ||
[14:22:46] [Server thread/ERROR]: Could not load 'plugins/mclogs-bukkit-2.3.1.jar' in folder 'plugins' | ||
org.bukkit.plugin.UnknownDependencyException: Unknown/missing dependency plugins: [example2, example1]. Please download and install these plugins to run 'Mclogs'. | ||
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:291) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?] | ||
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.loadPlugins(CraftServer.java:418) ~[paper-1.18.2.jar:git-Paper-333] | ||
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:288) ~[paper-1.18.2.jar:git-Paper-333] | ||
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1163) ~[paper-1.18.2.jar:git-Paper-333] | ||
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.18.2.jar:git-Paper-333] | ||
at java.lang.Thread.run(Thread.java:833) ~[?:?] | ||
[14:22:46] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it | ||
[14:22:46] [Server thread/INFO]: Preparing level "world" | ||
[14:22:52] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld | ||
[14:22:53] [Server thread/INFO]: Time elapsed: 243 ms | ||
[14:22:53] [Server thread/INFO]: Preparing start region for dimension minecraft:the_nether | ||
[14:22:53] [Server thread/INFO]: Time elapsed: 153 ms | ||
[14:22:53] [Server thread/INFO]: Preparing start region for dimension minecraft:the_end | ||
[14:22:53] [Server thread/INFO]: Time elapsed: 193 ms | ||
[14:22:53] [Server thread/INFO]: Starting GS4 status listener | ||
[14:22:53] [Server thread/INFO]: Thread Query Listener started | ||
[14:22:53] [Query Listener #1/INFO]: Query running on 0.0.0.0:9898 | ||
[14:22:53] [Server thread/INFO]: JMX monitoring enabled | ||
[14:22:53] [Server thread/INFO]: Running delayed init tasks | ||
[14:22:53] [Server thread/INFO]: Done (7.061s)! For help, type "help" | ||
[14:22:53] [Server thread/INFO]: Timings Reset |
42 changes: 42 additions & 0 deletions
42
test/data/bukkit/paper-plugin-dependency-1-18-2-duplicate.log
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,42 @@ | ||
[08:29:59] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD' | ||
[08:30:08] [Worker-Main-1/INFO]: Loaded 7 recipes | ||
[08:30:12] [Server thread/INFO]: Starting minecraft server version 1.18.2 | ||
[08:30:12] [Server thread/INFO]: Loading properties | ||
[08:30:12] [Server thread/INFO]: This server is running Paper version git-Paper-333 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT) (Git: 9fd870d) | ||
[08:30:12] [Server thread/INFO]: Server Ping Player Sample Count: 12 | ||
[08:30:12] [Server thread/INFO]: Using 4 threads for Netty based IO | ||
[08:30:13] [Server thread/INFO]: Default game type: SURVIVAL | ||
[08:30:13] [Server thread/INFO]: Generating keypair | ||
[08:30:13] [Server thread/INFO]: Starting Minecraft server on *:32699 | ||
[08:30:13] [Server thread/INFO]: Using epoll channel type | ||
[08:30:13] [Server thread/INFO]: Paper: Using libdeflate (Linux x86_64) compression from Velocity. | ||
[08:30:13] [Server thread/INFO]: Paper: Using OpenSSL 1.1.x (Linux x86_64) cipher from Velocity. | ||
[08:30:13] [Server thread/ERROR]: Could not load 'plugins/ViaBackwards-4.2.1.jar' in folder 'plugins' | ||
org.bukkit.plugin.UnknownDependencyException: Unknown/missing dependency plugins: [ViaVersion]. Please download and install these plugins to run 'ViaBackwards'. | ||
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:291) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?] | ||
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.loadPlugins(CraftServer.java:418) ~[paper-1.18.2.jar:git-Paper-333] | ||
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:288) ~[paper-1.18.2.jar:git-Paper-333] | ||
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1163) ~[paper-1.18.2.jar:git-Paper-333] | ||
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.18.2.jar:git-Paper-333] | ||
at java.lang.Thread.run(Thread.java:833) ~[?:?] | ||
[08:30:13] [Server thread/ERROR]: Could not load 'plugins/ViaBackwards-4.2.1.jar' in folder 'plugins' | ||
org.bukkit.plugin.UnknownDependencyException: Unknown/missing dependency plugins: [ViaVersion]. Please download and install these plugins to run 'ViaBackwards'. | ||
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:291) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?] | ||
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.loadPlugins(CraftServer.java:418) ~[paper-1.18.2.jar:git-Paper-333] | ||
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:288) ~[paper-1.18.2.jar:git-Paper-333] | ||
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1163) ~[paper-1.18.2.jar:git-Paper-333] | ||
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.18.2.jar:git-Paper-333] | ||
at java.lang.Thread.run(Thread.java:833) ~[?:?] | ||
[08:30:13] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it | ||
[08:30:13] [Server thread/INFO]: Preparing level "world" | ||
[08:30:24] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld | ||
[08:30:26] [Worker-Main-1/INFO]: Preparing spawn area: 0% | ||
[08:30:26] [Worker-Main-1/INFO]: Preparing spawn area: 99% | ||
[08:30:36] [Server thread/INFO]: Time elapsed: 937 ms | ||
[08:30:36] [Server thread/INFO]: Starting GS4 status listener | ||
[08:30:36] [Query Listener #1/INFO]: Query running on 0.0.0.0:9898 | ||
[08:30:36] [Server thread/INFO]: Thread Query Listener started | ||
[08:30:36] [Server thread/INFO]: JMX monitoring enabled | ||
[08:30:36] [Server thread/INFO]: Running delayed init tasks | ||
[08:30:36] [Server thread/INFO]: Done (24.549s)! For help, type "help" | ||
[08:30:36] [Server thread/INFO]: Timings Reset |
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,34 @@ | ||
[08:29:59] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD' | ||
[08:30:08] [Worker-Main-1/INFO]: Loaded 7 recipes | ||
[08:30:12] [Server thread/INFO]: Starting minecraft server version 1.18.2 | ||
[08:30:12] [Server thread/INFO]: Loading properties | ||
[08:30:12] [Server thread/INFO]: This server is running Paper version git-Paper-333 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT) (Git: 9fd870d) | ||
[08:30:12] [Server thread/INFO]: Server Ping Player Sample Count: 12 | ||
[08:30:12] [Server thread/INFO]: Using 4 threads for Netty based IO | ||
[08:30:13] [Server thread/INFO]: Default game type: SURVIVAL | ||
[08:30:13] [Server thread/INFO]: Generating keypair | ||
[08:30:13] [Server thread/INFO]: Starting Minecraft server on *:32699 | ||
[08:30:13] [Server thread/INFO]: Using epoll channel type | ||
[08:30:13] [Server thread/INFO]: Paper: Using libdeflate (Linux x86_64) compression from Velocity. | ||
[08:30:13] [Server thread/INFO]: Paper: Using OpenSSL 1.1.x (Linux x86_64) cipher from Velocity. | ||
[08:30:13] [Server thread/ERROR]: Could not load 'plugins/ViaBackwards-4.2.1.jar' in folder 'plugins' | ||
org.bukkit.plugin.UnknownDependencyException: Unknown/missing dependency plugins: [ViaVersion]. Please download and install these plugins to run 'ViaBackwards'. | ||
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:291) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?] | ||
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.loadPlugins(CraftServer.java:418) ~[paper-1.18.2.jar:git-Paper-333] | ||
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:288) ~[paper-1.18.2.jar:git-Paper-333] | ||
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1163) ~[paper-1.18.2.jar:git-Paper-333] | ||
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.18.2.jar:git-Paper-333] | ||
at java.lang.Thread.run(Thread.java:833) ~[?:?] | ||
[08:30:13] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it | ||
[08:30:13] [Server thread/INFO]: Preparing level "world" | ||
[08:30:24] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld | ||
[08:30:26] [Worker-Main-1/INFO]: Preparing spawn area: 0% | ||
[08:30:26] [Worker-Main-1/INFO]: Preparing spawn area: 99% | ||
[08:30:36] [Server thread/INFO]: Time elapsed: 937 ms | ||
[08:30:36] [Server thread/INFO]: Starting GS4 status listener | ||
[08:30:36] [Query Listener #1/INFO]: Query running on 0.0.0.0:9898 | ||
[08:30:36] [Server thread/INFO]: Thread Query Listener started | ||
[08:30:36] [Server thread/INFO]: JMX monitoring enabled | ||
[08:30:36] [Server thread/INFO]: Running delayed init tasks | ||
[08:30:36] [Server thread/INFO]: Done (24.549s)! For help, type "help" | ||
[08:30:36] [Server thread/INFO]: Timings Reset |
Oops, something went wrong.