Class WorldArgument<C>
java.lang.Object
cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull World>
net.pl3x.map.core.command.argument.WorldArgument<C>
- Type Parameters:
C- command sender type
- All Implemented Interfaces:
cloud.commandframework.keys.CloudKeyHolder<World>,Comparable<cloud.commandframework.arguments.CommandArgument<?,?>>
public class WorldArgument<C>
extends cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull World>
A
World argument that belongs to a command.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWorldArgument(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 World> Create a newWorldArgumentbuilder.static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull World> Create a requiredWorldArgument.static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull World> Create an optionalWorldArgument.static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull World> Create an optionalWorldArgumentwith a default value.static @NotNull Worldresolve(@NotNull cloud.commandframework.context.CommandContext<@NotNull Sender> context, @NotNull String name) ResolveWorldfrom 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
-
WorldArgument
protected WorldArgument(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 World> builder(@NotNull @NotNull String name) Create a newWorldArgumentbuilder.- Parameters:
name- argument name- Returns:
- new world argument builder
-
of
@NotNull public static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull World> of(@NotNull @NotNull String name) Create a requiredWorldArgument.- Parameters:
name- argument name- Returns:
- constructed world argument
-
optional
@NotNull public static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull World> optional(@NotNull @NotNull String name) Create an optionalWorldArgument.All arguments prior to any other required argument must also be required.
- Parameters:
name- argument name- Returns:
- constructed world argument
-
optional
@NotNull public static <C> @NotNull cloud.commandframework.arguments.CommandArgument<@NotNull C,@NotNull World> optional(@NotNull @NotNull String name, @NotNull @NotNull String defaultValue) Create an optionalWorldArgumentwith 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 world argument
-
resolve
@NotNull public static @NotNull World resolve(@NotNull @NotNull cloud.commandframework.context.CommandContext<@NotNull Sender> context, @NotNull @NotNull String name) ResolveWorldfrom command context.If context does not contain a
Worldand the sender is aPlayerthen the player's world will be used.- Parameters:
context- command contextname- argument name- Returns:
- world
- Throws:
WorldParseException- if context did not contain aWorldand the sender is not aPlayer, or the world is not enabled
-