| Constructor and Description |
|---|
ArgBungeePlugin() |
| Modifier and Type | Method and Description |
|---|---|
@Nullable List<String> |
getCompletions()
A list of completions for this argument type.
|
@NotNull String |
getName()
This is what your argument shows up as in a command.
|
boolean |
isPlural()
Used by the system to determine if this argument accepts multiple inputs.
|
boolean |
isRequired()
Used by the system when testing the command.
|
boolean |
matches(String string)
This is your matcher, to check if the player's input is valid.
|
@NotNull net.md_5.bungee.api.plugin.Plugin |
serialise(String string)
This should convert the player's input to a valid object.
|
ArgBungeePlugin |
setLabel(@NotNull String label)
Ideally, this should set a field that will then be returned by
Argument.getName(). |
ArgBungeePlugin |
setRequired(boolean boo)
Ideally, this should set a field that will then be returned by
Argument.isRequired(). |
@NotNull public @NotNull net.md_5.bungee.api.plugin.Plugin serialise(String string)
ArgumentArgument.matches(String) will be called first.
Generally, throw an exception if something goes wrong.public boolean matches(String string)
Argument
For example: a material-accepting argument checks if the string matches a Material enum and, if so, if the enum is a block.
In this case, "grass_block" would pass (Material.GRASS_BLOCK but "blob" and "diamond_sword" wouldn't as they are not materials/blocks respectively.
This should be a catch-all. If there is any chance of it not being valid, this should FAIL.
@NotNull public @NotNull String getName()
ArgumentGood examples: "block", "material", "entity", "player"
Bad examples: "string" (one exists already), "<test>" (the brackets are added later), "something" (vague and unhelpful), "blocks like stone" (should be one word), "verylongcommandargument" (too long).
@Nullable public @Nullable List<String> getCompletions()
ArgumentgetCompletions in interface Argument<net.md_5.bungee.api.plugin.Plugin>public boolean isPlural()
ArgumentThe command handler will automatically handle plural suggestions using comma separation.
Typical plurals: "stone,grass_block,dirt", "stone_stairs[facing=north],oak_log,stone_slab[half=top]"
public boolean isRequired()
ArgumentisRequired in interface Argument<net.md_5.bungee.api.plugin.Plugin>public ArgBungeePlugin setRequired(boolean boo)
ArgumentArgument.isRequired().
This should ALWAYS default to true.
Note: You may want to change the Argument returned to be of your implementing class type.
setRequired in interface Argument<net.md_5.bungee.api.plugin.Plugin>boo - True/false.public ArgBungeePlugin setLabel(@NotNull @NotNull String label)
ArgumentArgument.getName().
Note: You may want to change the Argument returned to be of your implementing class type.
Copyright © 2020. All rights reserved.