Class PointArgument<C>
java.lang.Object
cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Point>
net.pl3x.map.core.command.argument.PointArgument<C>
- Type Parameters:
C- command sender type
- All Implemented Interfaces:
cloud.commandframework.keys.CloudKeyHolder<Point>,Comparable<cloud.commandframework.arguments.CommandArgument<?,?>>
public class PointArgument<C>
extends cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Point>
A
Point argument that belongs to a command.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPointArgument(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 Point> Create a newPointArgumentbuilder.static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Point> Create a requiredPointArgument.static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Point> Create an optionalPointArgument.static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Point> Create an optionalPointArgumentwith a default value.static @NotNull Pointresolve(@NotNull cloud.commandframework.context.CommandContext<@NotNull Sender> context, @NotNull String name) ResolvePointfrom 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
-
PointArgument
protected PointArgument(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
-
builder
public static <C> @NotNull cloud.commandframework.arguments.CommandArgument.Builder<@NotNull C,@NotNull Point> builder(@NotNull @NotNull String name) Create a newPointArgumentbuilder.- Parameters:
name- argument name- Returns:
- new point argument builder
-
of
@NotNull public static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Point> of(@NotNull @NotNull String name) Create a requiredPointArgument.- Parameters:
name- argument name- Returns:
- constructed point argument
-
optional
@NotNull public static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Point> optional(@NotNull @NotNull String name) Create an optionalPointArgument.All arguments prior to any other required argument must also be required.
- Parameters:
name- argument name- Returns:
- constructed point argument
-
optional
@NotNull public static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull Point> optional(@NotNull @NotNull String name, @NotNull @NotNull String defaultValue) Create an optionalPointArgumentwith 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 point argument
-
resolve
@NotNull public static @NotNull Point resolve(@NotNull @NotNull cloud.commandframework.context.CommandContext<@NotNull Sender> context, @NotNull @NotNull String name) ResolvePointfrom command context.If context does not contain a
Pointand the sender is aSender.Playerthen the sender's location will be used, otherwise[0, 0]will be used- Parameters:
context- command contextname- argument name- Returns:
- player
-