Return correct result if plugin is already loaded/enabled
This commit is contained in:
parent
a82b90ce7d
commit
f10407b5ea
1 changed files with 3 additions and 0 deletions
|
|
@ -64,6 +64,7 @@ public class VelocityPluginManager extends AbstractPluginManager<PluginContainer
|
||||||
|
|
||||||
Object javaPluginLoader = RJavaPluginLoader.newInstance(proxy, file.toPath().getParent());
|
Object javaPluginLoader = RJavaPluginLoader.newInstance(proxy, file.toPath().getParent());
|
||||||
PluginDescription candidate = RJavaPluginLoader.loadPluginDescription(javaPluginLoader, file.toPath());
|
PluginDescription candidate = RJavaPluginLoader.loadPluginDescription(javaPluginLoader, file.toPath());
|
||||||
|
if (proxy.getPluginManager().isLoaded(candidate.getId())) return new VelocityLoadResult(Result.ALREADY_LOADED);
|
||||||
|
|
||||||
for (PluginDependency dependency : candidate.getDependencies()) {
|
for (PluginDependency dependency : candidate.getDependencies()) {
|
||||||
if (!dependency.isOptional() && !proxy.getPluginManager().isLoaded(dependency.getId())) {
|
if (!dependency.isOptional() && !proxy.getPluginManager().isLoaded(dependency.getId())) {
|
||||||
|
|
@ -84,6 +85,8 @@ public class VelocityPluginManager extends AbstractPluginManager<PluginContainer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result enablePlugin(PluginContainer container) {
|
public Result enablePlugin(PluginContainer container) {
|
||||||
|
if (proxy.getPluginManager().isLoaded(container.getDescription().getId())) return Result.ALREADY_ENABLED;
|
||||||
|
|
||||||
Object javaPluginLoader = RJavaPluginLoader.newInstance(
|
Object javaPluginLoader = RJavaPluginLoader.newInstance(
|
||||||
proxy,
|
proxy,
|
||||||
container.getDescription().getSource().map(Path::getParent).orElse(null)
|
container.getDescription().getSource().map(Path::getParent).orElse(null)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue