MCPcopy
hub / github.com/Col-E/Recaf / load

Method load

src/main/java/me/coley/recaf/plugin/PluginsManager.java:53–76  ·  view source on GitHub ↗

Initialize the plugin manager. @throws Exception See other throws. @throws PluginLoadException When loading specific plugin crashes when loaded. @throws IOException When the plugin directory cannot be read from or created. @throws IllegalStateException When the plugin does not properly defi

()

Source from the content-addressed store, hash-verified

51 * When the plugin does not properly define a name.
52 */
53 public void load() throws Exception {
54 PluginFolderSource source = new PluginFolderSource();
55 // Collect plugin instances
56 Collection<Object> instances = loadPlugins(source);
57 for (Object instance : instances) {
58 if (instance instanceof BasePlugin) {
59 BasePlugin plugin = (BasePlugin) instance;
60 String name = plugin.getName();
61 String version = plugin.getVersion();
62 String className = instance.getClass().getName();
63 BufferedImage icon =
64 source.getPluginIcons().get(source.getClassToPlugin().get(className));
65 Log.info("Discovered plugin '{}-{}'", name, version);
66 // PlugFace already has its own internal storage of the plugin instances,
67 // but we want to control them a bit easier. So we'll keep a local reference.
68 addPlugin(name, plugin, icon);
69 } else {
70 Log.error("Class '{}' does not extend plugin!", instance.getClass().getName());
71 }
72 }
73 // Done
74 if (!plugins.isEmpty())
75 Log.info("Loaded {} plugins", plugins.size());
76 }
77
78
79 /**

Callers 1

loadPluginsMethod · 0.95

Calls 12

getNameMethod · 0.95
getVersionMethod · 0.95
getPluginIconsMethod · 0.95
getClassToPluginMethod · 0.95
infoMethod · 0.95
addPluginMethod · 0.95
errorMethod · 0.95
loadPluginsMethod · 0.80
getClassMethod · 0.80
getMethod · 0.45
isEmptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected