if (clazz == null) {
try {
bot.pluginManager.load(args.getOrError(1));
print("Done.");
} catch (PluginNotFoundException e) {
throw new CommandException("Unknown Plugin");
} catch (InvalidPluginException e) {
throw new CommandException("Invalid Plugin:" + e.getMessage());
} catch (ClassNotFoundException e) {
throw new CommandException("Plugin Class not found");
} catch (IOException e) {
throw new CommandException("IOException: " + e.getMessage());
} catch (InstantiationException e) {
throw new CommandException("Could not create plugin: " + e.getMessage());
} catch (IllegalAccessException e) {
throw new CommandException("Constructor was private");
} catch (PluginAlreadyLoadedException e) {
throw new CommandException("Plugin already loaded");
}
} else {
try {
bot.pluginManager.loadInternal(clazz, args.getOrError(1));
if (args.getNamedParam('n') == null && args.getNamedParam("noenable") == null)
bot.pluginManager.enable(args.getOrError(1));
print("Done.");
} catch (IllegalAccessException e) {
throw new CommandException("Could not access constructor for Plugin");
} catch (InstantiationException e) {
throw new CommandException("Could not create new Plugin");
} catch (ClassNotFoundException e) {
throw new CommandException("Invalid Class");
} catch (PluginAlreadyLoadedException e) {
throw new CommandException("Plugin already loaded");
} catch (InvalidPluginException e) {
throw new CommandException("Invalid plugin: " + e.getMessage());
} catch (PluginNotFoundException e) {
throw new CommandException("Plugin does not exist");
}
}
}