Add plugin removal from the plugin manager.

This commit is contained in:
Danila Fedorin 2017-08-09 10:30:04 -07:00
parent ff8701a7bf
commit b99ad5a09a
1 changed files with 18 additions and 0 deletions

View File

@ -187,6 +187,24 @@ public class PluginManager {
}
}
/**
* Removes the plugin with the given class from the manager.
* @param toRemove the plugin to remove.
*/
public void removeClass(Class<? extends Plugin> toRemove){
if(!loadedPluginClasses.contains(toRemove)) return;
plugins.removeIf(plugin -> plugin.getClass() == toRemove);
loadedPluginClasses.remove(toRemove);
}
/**
* Removes all plugins from this plugin manager.
*/
public void removeAll(){
loadedPluginClasses.clear();
plugins.clear();
}
/**
* Loads all the plugins in the PluginManager.
*/