Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-25 15:50:19 +01:00
Merge pull request #387 from A248/fix-addToClasspath-preconditions
Permit passing PluginContainer to PluginManager#addToClasspath
Dieser Commit ist enthalten in:
Commit
09de77425d
@ -175,9 +175,12 @@ public class VelocityPluginManager implements PluginManager {
|
|||||||
public void addToClasspath(Object plugin, Path path) {
|
public void addToClasspath(Object plugin, Path path) {
|
||||||
checkNotNull(plugin, "instance");
|
checkNotNull(plugin, "instance");
|
||||||
checkNotNull(path, "path");
|
checkNotNull(path, "path");
|
||||||
checkArgument(pluginInstances.containsKey(plugin), "plugin is not loaded");
|
Optional<PluginContainer> optContainer = fromInstance(plugin);
|
||||||
|
checkArgument(optContainer.isPresent(), "plugin is not loaded");
|
||||||
|
Optional<?> optInstance = optContainer.get().getInstance();
|
||||||
|
checkArgument(optInstance.isPresent(), "plugin has no instance");
|
||||||
|
|
||||||
ClassLoader pluginClassloader = plugin.getClass().getClassLoader();
|
ClassLoader pluginClassloader = optInstance.get().getClass().getClassLoader();
|
||||||
if (pluginClassloader instanceof PluginClassLoader) {
|
if (pluginClassloader instanceof PluginClassLoader) {
|
||||||
((PluginClassLoader) pluginClassloader).addPath(path);
|
((PluginClassLoader) pluginClassloader).addPath(path);
|
||||||
} else {
|
} else {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren