public final void addPlugin(final Plugin plugin)
	{
		if (plugin.getDescription().getMain().contains("com.earth2me.essentials"))
		{
			return;
		}
		final List<Command> commands = PluginCommandYamlParser.parse(plugin);
		final String pluginName = plugin.getDescription().getName().toLowerCase(Locale.ENGLISH);

		for (Command command : commands)
		{
			final PluginCommand pc = (PluginCommand)command;
			final List<String> labels = new ArrayList<String>(pc.getAliases());
			labels.add(pc.getName());

			PluginCommand reg = ess.getServer().getPluginCommand(pluginName + ":" + pc.getName().toLowerCase(Locale.ENGLISH));
			if (reg == null)
			{
				reg = ess.getServer().getPluginCommand(pc.getName().toLowerCase(Locale.ENGLISH));
			}
			if (reg == null || !reg.getPlugin().equals(plugin))
			{
				continue;
			}
			for (String label : labels)
			{
				List<PluginCommand> plugincommands = altcommands.get(label.toLowerCase(Locale.ENGLISH));
				if (plugincommands == null)
				{
					plugincommands = new ArrayList<PluginCommand>();
					altcommands.put(label.toLowerCase(Locale.ENGLISH), plugincommands);
				}
				boolean found = false;
				for (PluginCommand pc2 : plugincommands)
				{
					if (pc2.getPlugin().equals(plugin))
					{
						found = true;
					}
				}
				if (!found)
				{
					plugincommands.add(reg);
				}
			}
		}
	}
 private void unRegisterBukkitCommand(PluginCommand cmd) {
   try {
     Object result = getPrivateField(plugin.getServer().getPluginManager(), "commandMap");
     SimpleCommandMap commandMap = (SimpleCommandMap) result;
     Object map = getPrivateField(commandMap, "knownCommands");
     @SuppressWarnings("unchecked")
     HashMap<String, Command> knownCommands = (HashMap<String, Command>) map;
     knownCommands.remove(cmd.getName());
     for (String alias : cmd.getAliases()) {
       knownCommands.remove(alias);
     }
   } catch (SecurityException
       | IllegalArgumentException
       | NoSuchFieldException
       | IllegalAccessException e) {
     e.printStackTrace();
   }
 }
  /**
   * Using Essentials own internal alternate commands map, assign HSP commands into the map. This is
   * a replication of the internal algorithm that Essentials uses in AlternativeCommandsHandler as
   * of Essentials 2.10.1.
   */
  private void mapHSPCommands() {
    Map<String, PluginCommand> hspCommands = bukkitCommandRegister.getLoadedCommands();
    Collection<PluginCommand> commands = hspCommands.values();
    //        final String pluginName = plugin.getDescription().getName().toLowerCase();

    log.debug("commands.size() = {}", commands == null ? null : commands.size());
    for (Command command : commands) {
      final PluginCommand pc = (PluginCommand) command;
      final List<String> labels = new ArrayList<String>(pc.getAliases());
      labels.add(pc.getName());

      log.debug("registering command {}", pc.getName());
      //            PluginCommand reg = plugin.getServer().getPluginCommand(pluginName + ":" +
      // pc.getName().toLowerCase());
      //            if (reg == null)
      //            {
      //                reg = plugin.getServer().getPluginCommand(pc.getName().toLowerCase());
      //            }
      //            if (reg == null || !reg.getPlugin().equals(plugin))
      //            {
      //                continue;
      //            }
      //            log.debug("reg = {}", reg);
      for (String label : labels) {
        log.debug("registering label {}", label);
        List<PluginCommand> plugincommands = altcommands.get(label.toLowerCase());
        if (plugincommands == null) {
          plugincommands = new ArrayList<PluginCommand>();
          altcommands.put(label.toLowerCase(), plugincommands);
        }
        boolean found = false;
        for (PluginCommand pc2 : plugincommands) {
          if (pc2.getPlugin().equals(plugin)) {
            found = true;
          }
        }
        if (!found) {
          plugincommands.add(pc);
        }
      }
    }
  }