|
|
|
@ -36,13 +36,6 @@ public class CommandRegistry
|
|
|
|
|
|
|
|
|
|
LOGGER.info("Registering command {}.", toRegister.getName());
|
|
|
|
|
commandSet.add(toRegister);
|
|
|
|
|
|
|
|
|
|
// Check for conflicting aliases
|
|
|
|
|
toRegister.getAliases().stream().filter(CommandRegistry::aliasExists).forEach(i ->
|
|
|
|
|
{
|
|
|
|
|
LOGGER.warn("Conflicting alias {} for command {}, removing. (original command: {})", i, toRegister.getName(), getAliasByName(i).get().getName());
|
|
|
|
|
toRegister.getAliases().remove(i);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -76,6 +69,15 @@ public class CommandRegistry
|
|
|
|
|
LOGGER.info("Removed command {}.", toUnregister.getName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the current state of the registry.
|
|
|
|
|
* @return RO set of the bank.
|
|
|
|
|
*/
|
|
|
|
|
public static Set<Command> getRegistry()
|
|
|
|
|
{
|
|
|
|
|
return Collections.unmodifiableSet(commandSet);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tells if the command is registered (excluding aliases).
|
|
|
|
|
* @param commandName Target command
|
|
|
|
|