Class PlayerArgument<C>
java.lang.Object
cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Player>
net.pl3x.map.core.command.argument.PlayerArgument<C>
- Type Parameters:
C- command sender type
- All Implemented Interfaces:
cloud.commandframework.keys.CloudKeyHolder<Player>,Comparable<cloud.commandframework.arguments.CommandArgument<?,?>>
public class PlayerArgument<C>
extends cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Player>
A
Player argument that belongs to a command.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPlayerArgument(boolean required, @NotNull String name, @NotNull String defaultValue, @NotNull BiFunction<@NotNull cloud.commandframework.context.CommandContext<@NotNull C>, @NotNull String, @NotNull List<@NotNull String>> suggestionsProvider, @NotNull cloud.commandframework.ArgumentDescription defaultDescription) -
Method Summary
Modifier and TypeMethodDescriptionstatic <C> @NotNull cloud.commandframework.arguments.CommandArgument.Builder<@NotNull C,@NotNull Player> newBuilder(@NotNull String name) Create a newPlayerArgumentbuilder.static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Player> Create a requiredPlayerArgument.static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Player> Create an optionalPlayerArgument.static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Player> Create an optionalPlayerArgumentwith a default value.static @NotNull Playerresolve(@NotNull cloud.commandframework.context.CommandContext<@NotNull Sender> context, @NotNull String name) ResolvePlayerfrom command context.Methods inherited from class cloud.commandframework.arguments.CommandArgument
addPreprocessor, compareTo, copy, equals, getDefaultDescription, getDefaultValue, getKey, getName, getOwningCommand, getParser, getSuggestionsProvider, getValueType, hasDefaultValue, hashCode, isArgumentRegistered, isRequired, ofType, ofType, preprocess, setArgumentRegistered, setOwningCommand, toString
-
Constructor Details
-
PlayerArgument
protected PlayerArgument(boolean required, @NotNull @NotNull String name, @NotNull @NotNull String defaultValue, @NotNull @NotNull BiFunction<@NotNull cloud.commandframework.context.CommandContext<@NotNull C>, @NotNull String, @NotNull List<@NotNull String>> suggestionsProvider, @NotNull @NotNull cloud.commandframework.ArgumentDescription defaultDescription)
-
-
Method Details
-
newBuilder
public static <C> @NotNull cloud.commandframework.arguments.CommandArgument.Builder<@NotNull C,@NotNull Player> newBuilder(@NotNull @NotNull String name) Create a newPlayerArgumentbuilder.- Parameters:
name- argument name- Returns:
- new player argument builder
-
of
@NotNull public static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Player> of(@NotNull @NotNull String name) Create a requiredPlayerArgument.- Parameters:
name- argument name- Returns:
- constructed player argument
-
optional
@NotNull public static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Player> optional(@NotNull @NotNull String name) Create an optionalPlayerArgument.All arguments prior to any other required argument must also be required.
- Parameters:
name- argument name- Returns:
- constructed player argument
-
optional
@NotNull public static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Player> optional(@NotNull @NotNull String name, @NotNull @NotNull String defaultValue) Create an optionalPlayerArgumentwith a default value.All arguments prior to any other required argument must also be required.
- Parameters:
name- argument namedefaultValue- default value that will be used if none was supplied- Returns:
- constructed player argument
-
resolve
@NotNull public static @NotNull Player resolve(@NotNull @NotNull cloud.commandframework.context.CommandContext<@NotNull Sender> context, @NotNull @NotNull String name) ResolvePlayerfrom command context.If context does not contain a
Playerand the sender is aSender.Playerthen the sender will be used.- Parameters:
context- command contextname- argument name- Returns:
- player
- Throws:
PlayerParseException- if context did not contain aPlayerand the sender is not aSender.Player
-