Making an element. - ryandw11/CommandMaker GitHub Wiki

To make a custom element you need to make a new class that implements element.

public class CustomElement implements Element {
	@Override
	public boolean onElement(CommandSender sender, String[] args, CommandMakerCMD cmd) {
		
		return false;
	}
	
}

If you return false that means the element executed fine. If you return true then there was an error and the command will stop being processed.
Commands can be ran in the console if enabled which is why CommandSender is used instead of player. Try to use CommandSender unless you can't. If you can't check to see if the sender is the console. If it is return true. Be nice and tell the server owner why it didn't work.

args are the arguments. Checking to see if the player has enough arguments is already done by the plugin. Args is there to use to grab data.

Finally CommandMakerCMD is the command it self. The command and it's information is stored in there.
Example of a completed element:

public class CustomElement implements Element {

        private CommandAPI cmdAPI;
        public CustomElement(){
            cmdAPI = new CommandAPI();
        }

	@Override
	public boolean onElement(CommandSender sender, String[] args, CommandMakerCMD cmd) {
		cmd.getCommand(); // return the YamlConfiguration.
                String s = cmdAPI.phaseArgs(cmd.getCommand().getString("customelement"), args);
                sender.sendMessage(s);
		return false;
	}
	
}

In your onEnable you need to register the command.

@Override
public void onEnable(){
    CommandAPI cmdAPI = new CommandAPI();
    cmdAPI.registerElement("customelement", new CustomElement());		
}