CommanderAPI a0.2

The best and easiest way to create commands and arguments with an interface!

  1. undestroy
    Tested Minecraft Versions:
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    Languages Supported:
    German, Spanish, France
    CommanderAPI
    This api allows developers to easily create commands and its properties. This plugin is the easiest way to produce
    very impressive commands.

    Here is how:
    Code (Java):
    // The meaning behind that "ComGuild" is, that developers can use different messages and config types per plugin.[/B]
    [B]
            final ComGuild guild = new ComGuild(plugin);

            // The config of the guild. Here you can change the messages and default config stuff.
            final ComConfig config = guild.getConfig();

            /**
             * Change config is optional and not necessary!
             * Message - Placeholders:
             * {cmd-syntax} = syntax of command,
             * {prop-syntax} = syntax of property,
             * {prop} = property name,
             * {cmd] = command name
             */

            config.setProperty(ComPropertyType.MESSAGE_CMD_SYNTAX, "§e[CommanderAPI] §cInvalid syntax. Try §f{cmd-syntax} §cinstead.");
            config.setProperty(ComPropertyType.MESSAGE_PROP_SYNTAX, "§e[CommanderAPI] §cInvalid syntax. Try §f{prop-syntax} §cinstead.");
            config.setProperty(ComPropertyType.MESSAGE_PROP_NOT_EXISTING, "§e[CommanderAPI] §cThe given property §f{prop} §cis not existing.");

            // Register the
            CommanderAPI.registerCommand(new ComCommandExample(guild));


    Code (Java):
    @ComCommand.CommandDescription ([/B]
    [B]
            /* The name of the command */
            propName = "friend",

            /* The alias of the command, you can use as many as you want */
            propAlias = {"f"},

            /* The syntax displayed in chat for this command */
            propSyntax = "friend add/remove (name)",

            /* The needed arguments. If you set this to a negative number it will automatically disables.
            * If the player didn't enter as many arguments as you set here, the message MESSAGE_CMD_SYNTAX will appear. */

            propNeedArguments = 2)

    public class ComCommandExample extends ComCommand {

        public ComCommandExample(ComGuild guild) {
            super(guild);
        }

        /**
         * When the command gets executed
         * Return true when you don't want to execute the property methods. (methods below with Annotation)
         */

        @Override
        public boolean execute(Player player, String command, String[] arguments) {
            return false;
        }

        @CommandDescription(
                /* The name of the property (argument 0) */
                propName = "add",

                /* The syntax of the property (argument 0) */
                propSyntax = "add <Name>",

                /* The needed number of arguments for the property (argument 0) */
                propNeedArguments = 1,

                /* The alias/es (shorthandle/s) of the property (argument 0) */
                propAlias = {"+"})
        public void onPropExecAdd(Player player, String prop, String[] arguments) {
            String name = arguments[0];
            player.sendMessage(String.format("You have added %s!", name));
        }

        @CommandDescription(propName = "rem", propSyntax = "rem <Name>", propNeedArguments = 1, propAlias = {"-"})
        public void onPropExecRem(Player player, String prop, String[] arguments) {
            String name = arguments[0];
            player.sendMessage(String.format("You have removed %s!", name));
        }
    }


    You have to use Annotation to create an command (it's something like you see in the Spoiler "Show Command Code" on the actual first line before the class block is getting initiated).

    You can easily create command properties with an Annotation. A command property is e.g. "/friend add xyz" so it's the given "do that" by the player when the command was sent.
    In this example, you'd add "xyz" to your friend list.
    You use the same Annotation for a Method (if you want to use a command property) like the Annotation above the class native keyword. You need help? Contact me on spigotmc!

    Really easy, isn't it?

    This plugin is needed for almost every new project of mine.


Recent Updates

  1. Added "propDescription"