Constructor and Description |
---|
ArgBungeePlayer() |
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.connection.ProxiedPlayer |
serialise(String string)
This should convert the player's input to a valid object.
|
ArgBungeePlayer |
setLabel(@NotNull String label)
Ideally, this should set a field that will then be returned by
Argument.getName() . |
ArgBungeePlayer |
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.connection.ProxiedPlayer serialise(String string)
Argument
Argument.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()
Argument
Good 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()
Argument
getCompletions
in interface Argument<net.md_5.bungee.api.connection.ProxiedPlayer>
public boolean isPlural()
Argument
The 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()
Argument
isRequired
in interface Argument<net.md_5.bungee.api.connection.ProxiedPlayer>
public ArgBungeePlayer setRequired(boolean boo)
Argument
Argument.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.connection.ProxiedPlayer>
boo
- True/false.public ArgBungeePlayer setLabel(@NotNull @NotNull String label)
Argument
Argument.getName()
.
Note: You may want to change the Argument
returned to be of your implementing class type.
Copyright © 2020. All rights reserved.