for (Map.Entry<String, ModuleProperties> module: p.entrySet()) {
String factClass = module.getValue().getCommandFactoryClassName();
String initClass = module.getValue().getCommandInitializerClassName();
if (factClass != null && initClass != null) {
try {
ModuleCommandFactory fact = (ModuleCommandFactory) Util.getInstance(factClass, cl);
Class<? extends ModuleCommandInitializer> initClazz = Util.loadClass(initClass, cl);
for (Map.Entry<Byte, Class<? extends ReplicableCommand>> entry: fact.getModuleCommands().entrySet()) {
byte id = entry.getKey();
if (commandFactories.containsKey(id))
throw new IllegalArgumentException("Module " + module.getKey() + " cannot use id " + id + " for commands, as it is already in use by " + commandFactories.get(id).getClass().getName());
commandFactories.put(id, fact);
commandInitializers.put(id, initClazz);