Removed code duplication in Composite Command constructor

This commit is contained in:
tastybento 2018-06-23 16:32:53 -07:00
parent 9b8d42f692
commit f12bc17ca3

View File

@ -122,24 +122,8 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
* @param aliases - aliases
*/
public CompositeCommand(Addon addon, String label, String... aliases) {
super(label);
this.topLabel = label;
this(label, aliases);
this.addon = addon;
this.plugin = BSkyBlock.getInstance();
setAliases(new ArrayList<>(Arrays.asList(aliases)));
parent = null;
setUsage("");
subCommandLevel = 0; // Top level
subCommands = new LinkedHashMap<>();
subCommandAliases = new LinkedHashMap<>();
// Register command if it is not already registered
if (plugin.getCommand(label) == null) {
plugin.getCommandsManager().registerCommand(this);
}
setup();
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
new DefaultHelpCommand(this);
}
}
/**