3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-24 23:30:26 +01:00

Permit passing PluginContainer to PluginManager#addToClasspath

Dieser Commit ist enthalten in:
A248 2020-11-07 14:53:09 -05:00
Ursprung d51f357fa8
Commit 46da2553fb

Datei anzeigen

@ -175,9 +175,12 @@ public class VelocityPluginManager implements PluginManager {
public void addToClasspath(Object plugin, Path path) {
checkNotNull(plugin, "instance");
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) {
((PluginClassLoader) pluginClassloader).addPath(path);
} else {