Search in sources :

Example 1 with AliasConfiguration

use of org.cubeengine.butler.alias.AliasConfiguration in project core by CubeEngine.

the class CubeCommandManager method registerSpongeCommand.

private Optional<CommandMapping> registerSpongeCommand(CommandDescriptor descriptor) {
    ArrayList<String> aliasList = new ArrayList<>();
    aliasList.add(descriptor.getName().toLowerCase());
    for (AliasConfiguration alias : descriptor.getAliases()) {
        if ((alias.getDispatcher() == null || (alias.getDispatcher() != null && alias.getDispatcher().length == 0))) {
            aliasList.add(alias.getName().toLowerCase());
        }
    }
    PluginContainer plugin = mm.getPlugin(descriptor.getOwner()).orElse(mm.getPlugin(LibCube.class).get());
    return baseDispatcher.register(plugin, new ProxyCallable(this, commandTime, descriptor.getName(), logger), aliasList);
}
Also used : PluginContainer(org.spongepowered.api.plugin.PluginContainer) ArrayList(java.util.ArrayList) AliasConfiguration(org.cubeengine.butler.alias.AliasConfiguration)

Aggregations

ArrayList (java.util.ArrayList)1 AliasConfiguration (org.cubeengine.butler.alias.AliasConfiguration)1 PluginContainer (org.spongepowered.api.plugin.PluginContainer)1