LogoUndefined Creations
Arguments/Basic

String Argument

The StringArgument is an argument that allows you to type a string, as allowed by its StringType, and returns that String:

new StellarCommand("server")
    .addStringArgument("string", StringType.WORD) // default
StellarCommand("server")
    .addStringArgument("string", StringType.WORD) // default

Alphanumeric Word

A StringArgument of type StringType.ALPHANUMERIC_WORD means that you type anything in the English alphabet, including numbers, but nothing more. If this limits you, consider the next options.

Alphanumeric Word Argument

Word

A StringArgument of type StringType.WORD is a word that does not have any restrictions.

Word Argument

Quotable Phrase

The QUOTABLE_PHRASE has the same limitation as ALPHANUMERIC_WORD, but when in quotations (""), it becomes limitless.

Word Argument

Phrase

You can type anything you want using this, the only problem here is that it's a phrase, not a word. This means that you are not able to add any other arguments afterward. Thus, this argument should always be the last argument.

To be able to use a Phrase argument and handle each word independently, use the PhraseArgument. It contains a list of WordArgument, which you can customize:

StellarCommand("server")
    .addPhraseArgument("args")
    .addWordArgument(index = 0) { // Extension function of WordArgument
        addExecution<Player> { // extension function of PhraseCommandContext
            getArgument(0)
            this[0]
        }
    }
    .addWordSuggestions(index = 1, "first", "second")

Phrase Argument