@Override
    public void onMessage(String channel, String sender, String login, String hostname, String m){
    	if(m.toLowerCase().startsWith((String) prefix)){
    		int max = m.length();
    		for(int i = 0; i < m.length(); i++){
        		char c = m.toCharArray()[i];
        		if(c == ' ')
        			max = i;
        	}
        	
        	String message = m.substring(1, max);

	    	if(CommandRegistry.commandExists(message.toLowerCase())){
	    		ICommand command = CommandRegistry.getCommand(message);
	    		if(!command.requiresOp()){
	    			command.executeCommand(m.substring(max), sender, channel);
	    		}else if(command.requiresOp()){
	    			if(UserHelper.isOp(sender, channel))
	    				command.executeCommand(m.substring(max), sender, channel);
	    			else
	    				sendNotice(sender, Messages.needOP);
	    		}
	    	}else{
	    		sendNotice(sender, Messages.invalidCommand);
	    	}
    	}
    }