public Class<?> getClassByName(final String name) {
    Class<?> cachedClass = classes.get(name);

    if (cachedClass != null) {
      return cachedClass;
    } else {
      for (String current : loaders.keySet()) {
        PluginClassLoader loader = loaders.get(current);

        try {
          cachedClass = loader.findClass(name, false);
        } catch (ClassNotFoundException cnfe) {
        }
        if (cachedClass != null) {
          return cachedClass;
        }
      }
    }
    return null;
  }
  public void disablePlugin(Plugin plugin) {
    if (!(plugin instanceof JavaPlugin)) {
      throw new IllegalArgumentException("Plugin is not associated with this PluginLoader");
    }

    if (plugin.isEnabled()) {
      JavaPlugin jPlugin = (JavaPlugin) plugin;
      ClassLoader cloader = jPlugin.getClassLoader();

      try {
        jPlugin.setEnabled(false);
      } catch (Throwable ex) {
        server
            .getLogger()
            .log(
                Level.SEVERE,
                "Error occurred while disabling "
                    + plugin.getDescription().getFullName()
                    + " (Is it up to date?): "
                    + ex.getMessage(),
                ex);
      }

      server.getPluginManager().callEvent(new PluginDisableEvent(plugin));

      loaders.remove(jPlugin.getDescription().getName());

      if (cloader instanceof PluginClassLoader) {
        PluginClassLoader loader = (PluginClassLoader) cloader;
        Set<String> names = loader.getClasses();

        for (String name : names) {
          removeClass(name);
        }
      }
    }
  }