@Override
	@SuppressWarnings("unchecked")
	public boolean mcp(final Session session, final StringBuilder str, String[] mcpKey, 
					   final Map<String,float[]> clientSupported, final Map<String,String> keyValuePairs)
	{
		Map<String,MCPPackage> mcpPackages = (Map<String,MCPPackage>)Resources.getResource("MCP_COMPILED_PACKAGES");
		if(mcpPackages == null)
		{
			synchronized(this)
			{
				mcpPackages = (Map<String,MCPPackage>)Resources.getResource("MCP_COMPILED_PACKAGES");
				if(mcpPackages == null)
				{
					mcpPackages = new Hashtable<String,MCPPackage>();
					List<MCPPackage> pkgs = new ArrayList<MCPPackage>();
					if(CMClass.loadObjectListToObj(pkgs, "com/planet_ink/coffee_mud/Libraries/mcppkgs/", CMProps.instance().getStr("MCPPACKAGES"), "com.planet_ink.coffee_mud.Libraries.interfaces.ProtocolLibrary$MCPPackage"))
					{
						for(MCPPackage pkg : pkgs )
						{
							mcpPackages.put(pkg.packageName(), pkg);
						}
					}
					Resources.submitResource("MCP_COMPILED_PACKAGES", mcpPackages);
				}
			}
		}
		
		String s = str.substring(3).trim();
		boolean[] execute = new boolean[1];
		if(s.length()==0)
			return false;
		if(s.charAt(0)=='*')
		{
			if(!parseMcpCont(s,execute,keyValuePairs))
			{
				return false;
			}
		}
		else
		if(s.charAt(0)==':')
		{
			if(!parseMcpEnd(s,execute,keyValuePairs))
			{
				return false;
			}
		}
		else
		{
			if(!parseMcpStart(s,execute,keyValuePairs))
			{
				return false;
			}
		}
		if(execute[0])
		{
			if((!keyValuePairs.containsKey(MCP_COMMAND_KEY()))
			||((!keyValuePairs.get(MCP_COMMAND_KEY()).equals("mcp"))
				&&(!keyValuePairs.containsKey(MCP_KEYSENT_KEY()))))
			{
				Log.errOut("Invalid MCP PROCESS -- no command or key sent: " + s);
				return false;
			}
			String pkgCmd = keyValuePairs.get(MCP_COMMAND_KEY());
			String keySent = keyValuePairs.get(MCP_KEYSENT_KEY());
			if((keySent != null)&&(mcpKey[0]!=null)&&(!keySent.equals(mcpKey[0])))
			{
				Log.errOut("Invalid MCP PROCESS -- invalid key sent: " + keySent+": "+mcpKey[0]+": "+s);
				return false;
			}
			else
			if(pkgCmd.equals("mcp"))
			{
				if(keyValuePairs.containsKey("authentication-key"))
				{
					mcpKey[0] = keyValuePairs.get("authentication-key");
				}
				else
				{
					Log.errOut("Invalid MCP PROCESS -- NO key Sent: "+s);
					return false;
				}
				for(String commandKey : mcpPackages.keySet())
				{
					MCPPackage pkg = mcpPackages.get(commandKey);
					session.rawPrintln("#$#mcp-negotiate-can "+mcpKey[0]+" package: "+pkg.packageName()+" min-version: "+pkg.minVersion()+" max-version: "+pkg.maxVersion());
				}
				session.rawPrintln("#$#mcp-negotiate-end "+mcpKey[0]);
			}
			else
			{
				MCPPackage pkg = mcpPackages.get(pkgCmd);
				if(pkg == null)
				{
					for(String commandKey : mcpPackages.keySet())
					{
						if(pkgCmd.startsWith(commandKey+"-"))
						{
							pkg = mcpPackages.get(commandKey);
							break;
						}
					}
				}
				if(pkg != null)
				{
					pkg.executePackage(session, pkgCmd, clientSupported, keyValuePairs);
				}
			}
			keyValuePairs.clear();
		}
		return true;
	}