@Nonnull
	PluginUnloader unloaderFor(@Nonnull String id) {
		LoadedPlugin plugin = plugins.get(id);
		if (plugin == null) {
			throw new IllegalStateException("Plugin %s is not loaded".formatted(id));
		}
		Map<LoadedPlugin, Set<LoadedPlugin>> dependants = HashMap.newHashMap(8);
		collectDependants(plugin, dependants);
		return new PluginUnloader() {
			@Override
			public void commit() throws PluginException {
				PluginException ex = unload(plugin, dependants);
				if (ex != null)
					throw ex;
			}

			@Nonnull
			@Override
			public PluginInfo unloadingPlugin() {
				return plugin.getContainer().info();
			}

			@Nonnull
			@Override
			public Stream<PluginInfo> dependants() {
				return dependants.values()
						.stream()
						.flatMap(Collection::stream)
						.map(plugin -> plugin.getContainer().info());
			}
		};
	}
@param id
		Plugin identifier.

@return Plugin unload action.
recaf-core/src/main/java/software/coley/recaf/services/plugin/PluginGraph.java