Interface Arguments
The argument types the server knows how to parse, suggest and send to clients.
Arguments depending on the executor or location parse to an ArgumentResolver.
argument("targets", Arguments.arguments().players())- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.brigadier.arguments.ArgumentType<AngleResolver> angle()Returns an angle in degrees, absolute or relative (~).static ArgumentsReturns the argument types.com.mojang.brigadier.arguments.ArgumentType<BlockPositionResolver> Returns a block position, absolute, relative (~) or local (^).com.mojang.brigadier.arguments.ArgumentType<BossBar.Color> Returns a boss bar color.com.mojang.brigadier.arguments.ArgumentType<BossBar.Flag> Returns a boss bar flag.com.mojang.brigadier.arguments.ArgumentType<BossBar.Overlay> Returns a boss bar overlay.com.mojang.brigadier.arguments.ArgumentType<ColumnPositionResolver> Returns a block column, absolute or relative (~).com.mojang.brigadier.arguments.ArgumentType<Component> Returns a text component.Returns an inclusive double range, possibly open on either end.com.mojang.brigadier.arguments.ArgumentType<Duration> duration()Returns a chain of amount/unit pairs (w,d,h,m,s), such as1w3d12h.com.mojang.brigadier.arguments.ArgumentType<EntitiesResolver> entities()Returns a selector matching any number of entities.com.mojang.brigadier.arguments.ArgumentType<EntitiesResolver> Returns a selector matching any number of entities accepted byfilter.com.mojang.brigadier.arguments.ArgumentType<EntityResolver> entity()Returns a selector matching exactly one entity.com.mojang.brigadier.arguments.ArgumentType<EntityResolver> Returns a selector matching exactly one entity accepted byfilter.com.mojang.brigadier.arguments.ArgumentType<GameMode> gameMode()Returns a game mode.com.mojang.brigadier.arguments.ArgumentType<TextColor> hexColor()Returns a hex color.Returns an inclusive integer range, possibly open on either end.Returns a predicate matching item stacks.com.mojang.brigadier.arguments.ArgumentType<ItemStack> Returns an item stack, with its components.com.mojang.brigadier.arguments.ArgumentType<Key> key()Returns a key.<N,T> com.mojang.brigadier.arguments.ArgumentType <T> map(com.mojang.brigadier.arguments.ArgumentType<N> nativeType, ArgumentMapper<N, T> mapper) ReturnsnativeType, its parsed value converted bymapper.<N,T> com.mojang.brigadier.arguments.ArgumentType <T> map(com.mojang.brigadier.arguments.ArgumentType<N> nativeType, ArgumentMapper<N, T> mapper, com.mojang.brigadier.suggestion.SuggestionProvider<CommandSource> suggestions) ReturnsnativeType, its parsed value converted bymapperand its suggestions replaced.com.mojang.brigadier.arguments.ArgumentType<NamedTextColor> Returns aNamedTextColor.com.mojang.brigadier.arguments.ArgumentType<NbtPath> nbtPath()Returns an NBT path.com.mojang.brigadier.arguments.ArgumentType<String> Returns the input matchingpatternfrom the cursor.com.mojang.brigadier.arguments.ArgumentType<PlayerResolver> player()Returns a selector matching exactly one player.com.mojang.brigadier.arguments.ArgumentType<PlayerResolver> Returns a selector matching exactly one player accepted byfilter.com.mojang.brigadier.arguments.ArgumentType<PlayerProfilesResolver> Returns a selector or name resolving to player profiles.com.mojang.brigadier.arguments.ArgumentType<PlayerProfilesResolver> playerProfiles(Predicate<Player> filter) Returns a selector or name resolving to player profiles, online players filtered byfilter.com.mojang.brigadier.arguments.ArgumentType<PlayersResolver> players()Returns a selector matching any number of players.com.mojang.brigadier.arguments.ArgumentType<PlayersResolver> Returns a selector matching any number of players accepted byfilter.com.mojang.brigadier.arguments.ArgumentType<PositionResolver> position()Returns a position, absolute, relative (~) or local (^).com.mojang.brigadier.arguments.ArgumentType<Key> Returns a post effect; players are suggested those of their loaded resource packs when possible.<T> com.mojang.brigadier.arguments.ArgumentType<T> resource(RegistryKey<T> registryKey) Returns a value ofregistryKey, resolved when parsed; suggested by the client.<T> com.mojang.brigadier.arguments.ArgumentType<TypedKey<T>> resourceKey(RegistryKey<T> registryKey) Returns a typed key ofregistryKey, not checked against the registry.<T> com.mojang.brigadier.arguments.ArgumentType<T> serverResource(RegistryKey<T> registryKey) Returns a value ofregistryKey, resolved when parsed; validated and suggested by the server.com.mojang.brigadier.arguments.ArgumentType<Style> style()Returns a style.com.mojang.brigadier.arguments.ArgumentType<SwingAnimation.SwingAnimationType> Returns a swing animation type.default com.mojang.brigadier.arguments.ArgumentType<Integer> time()Returns a time in ticks, such as1d,5s,6tor2.com.mojang.brigadier.arguments.ArgumentType<Integer> time(int minTicks) Returns a time in ticks of at leastminTicks.com.mojang.brigadier.arguments.ArgumentType<UUID> uuid()Returns a UUID.<T> com.mojang.brigadier.arguments.ArgumentType<T> withClientSuggestions(com.mojang.brigadier.arguments.ArgumentType<T> type, List<String> values) Returnstype, suggested by the client fromvalues.<T> com.mojang.brigadier.arguments.ArgumentType<T> withClientSuggestions(com.mojang.brigadier.arguments.ArgumentType<T> type, Key suggestionSource, @Nullable com.mojang.brigadier.suggestion.SuggestionProvider<CommandSource> fallbackSuggestions) Returnstype, suggested by the client fromsuggestionSource.<T> com.mojang.brigadier.arguments.ArgumentType<T> withServerSuggestions(com.mojang.brigadier.arguments.ArgumentType<T> type) Returnstype, suggested by the server instead of the client.com.mojang.brigadier.arguments.ArgumentType<World> world()Returns a loaded world.
-
Method Details
-
arguments
-
entity
com.mojang.brigadier.arguments.ArgumentType<EntityResolver> entity()Returns a selector matching exactly one entity.- Returns:
- a selector matching exactly one entity
- Since:
- 0.1.0
-
entity
Returns a selector matching exactly one entity accepted byfilter.- Parameters:
filter- the predicate the entity must satisfy- Returns:
- a selector matching exactly one entity accepted by
filter - Since:
- 0.1.0
-
entities
com.mojang.brigadier.arguments.ArgumentType<EntitiesResolver> entities()Returns a selector matching any number of entities.- Returns:
- a selector matching any number of entities
- Since:
- 0.1.0
-
entities
Returns a selector matching any number of entities accepted byfilter.- Parameters:
filter- the predicate each entity must satisfy- Returns:
- a selector matching any number of entities accepted by
filter - Since:
- 0.1.0
-
player
com.mojang.brigadier.arguments.ArgumentType<PlayerResolver> player()Returns a selector matching exactly one player.- Returns:
- a selector matching exactly one player
- Since:
- 0.1.0
-
player
Returns a selector matching exactly one player accepted byfilter.- Parameters:
filter- the predicate the player must satisfy- Returns:
- a selector matching exactly one player accepted by
filter - Since:
- 0.1.0
-
players
com.mojang.brigadier.arguments.ArgumentType<PlayersResolver> players()Returns a selector matching any number of players.- Returns:
- a selector matching any number of players
- Since:
- 0.1.0
-
players
Returns a selector matching any number of players accepted byfilter.- Parameters:
filter- the predicate each player must satisfy- Returns:
- a selector matching any number of players accepted by
filter - Since:
- 0.1.0
-
playerProfiles
com.mojang.brigadier.arguments.ArgumentType<PlayerProfilesResolver> playerProfiles()Returns a selector or name resolving to player profiles.- Returns:
- a selector or name resolving to player profiles
- Since:
- 0.1.0
-
playerProfiles
com.mojang.brigadier.arguments.ArgumentType<PlayerProfilesResolver> playerProfiles(Predicate<Player> filter) Returns a selector or name resolving to player profiles, online players filtered byfilter.- Parameters:
filter- the predicate each online player must satisfy- Returns:
- a selector or name resolving to player profiles, online players filtered by
filter - Since:
- 0.1.0
-
gameMode
com.mojang.brigadier.arguments.ArgumentType<GameMode> gameMode()Returns a game mode.- Returns:
- a game mode
- Since:
- 0.1.0
-
uuid
com.mojang.brigadier.arguments.ArgumentType<UUID> uuid()Returns a UUID.- Returns:
- a UUID
- Since:
- 0.1.0
-
blockPosition
com.mojang.brigadier.arguments.ArgumentType<BlockPositionResolver> blockPosition()Returns a block position, absolute, relative (~) or local (^).- Returns:
- a block position, absolute, relative (
~) or local (^) - Since:
- 0.1.0
-
columnPosition
com.mojang.brigadier.arguments.ArgumentType<ColumnPositionResolver> columnPosition()Returns a block column, absolute or relative (~).- Returns:
- a block column, absolute or relative (
~) - Since:
- 0.1.0
-
position
com.mojang.brigadier.arguments.ArgumentType<PositionResolver> position()Returns a position, absolute, relative (~) or local (^).- Returns:
- a position, absolute, relative (
~) or local (^) - Since:
- 0.1.0
-
angle
com.mojang.brigadier.arguments.ArgumentType<AngleResolver> angle()Returns an angle in degrees, absolute or relative (~).- Returns:
- an angle in degrees, absolute or relative (
~) - Since:
- 0.1.0
-
world
com.mojang.brigadier.arguments.ArgumentType<World> world()Returns a loaded world.- Returns:
- a loaded world
- Since:
- 0.1.0
-
itemStack
com.mojang.brigadier.arguments.ArgumentType<ItemStack> itemStack()Returns an item stack, with its components.- Returns:
- an item stack, with its components
- Since:
- 0.1.0
-
itemPredicate
-
swingAnimationType
com.mojang.brigadier.arguments.ArgumentType<SwingAnimation.SwingAnimationType> swingAnimationType()Returns a swing animation type.- Returns:
- a swing animation type
- Since:
- 0.1.0
-
component
com.mojang.brigadier.arguments.ArgumentType<Component> component()Returns a text component.- Returns:
- a text component
- Since:
- 0.1.0
-
style
com.mojang.brigadier.arguments.ArgumentType<Style> style()Returns a style.- Returns:
- a style
- Since:
- 0.1.0
-
namedColor
com.mojang.brigadier.arguments.ArgumentType<NamedTextColor> namedColor()Returns aNamedTextColor.- Returns:
- a
NamedTextColor - Since:
- 0.1.0
-
hexColor
com.mojang.brigadier.arguments.ArgumentType<TextColor> hexColor()Returns a hex color.- Returns:
- a hex color
- Since:
- 0.1.0
-
bossBarColor
com.mojang.brigadier.arguments.ArgumentType<BossBar.Color> bossBarColor()Returns a boss bar color.- Returns:
- a boss bar color
- Since:
- 0.1.0
-
bossBarOverlay
com.mojang.brigadier.arguments.ArgumentType<BossBar.Overlay> bossBarOverlay()Returns a boss bar overlay.- Returns:
- a boss bar overlay
- Since:
- 0.1.0
-
bossBarFlag
com.mojang.brigadier.arguments.ArgumentType<BossBar.Flag> bossBarFlag()Returns a boss bar flag.- Returns:
- a boss bar flag
- Since:
- 0.1.0
-
integerRange
-
doubleRange
-
time
Returns a time in ticks, such as1d,5s,6tor2.- Returns:
- a time in ticks, such as
1d,5s,6tor2 - Since:
- 0.1.0
-
time
Returns a time in ticks of at leastminTicks.- Parameters:
minTicks- the minimum, inclusive- Returns:
- a time in ticks of at least
minTicks - Since:
- 0.1.0
-
duration
com.mojang.brigadier.arguments.ArgumentType<Duration> duration()Returns a chain of amount/unit pairs (w,d,h,m,s), such as1w3d12h.A bare number is rejected.
- Returns:
- a chain of amount/unit pairs (
w,d,h,m,s), such as1w3d12h - Since:
- 0.1.0
-
key
-
pattern
com.mojang.brigadier.arguments.ArgumentType<String> pattern(Pattern pattern, @Nullable Component errorMessage) Returns the input matchingpatternfrom the cursor.The match may stop before the end of the input. Only the pattern's source is sent to clients, so it is necessary to use inline flags, such as
(?i), instead ofPattern.flags().- Parameters:
pattern- the pattern, without flagserrorMessage- shown when the input doesn't match ornull- Returns:
- the input matching
patternfrom the cursor - Since:
- 0.1.0
-
resourceKey
<T> com.mojang.brigadier.arguments.ArgumentType<TypedKey<T>> resourceKey(RegistryKey<T> registryKey) Returns a typed key ofregistryKey, not checked against the registry.- Type Parameters:
T- the registry value type- Parameters:
registryKey- the registry- Returns:
- a typed key of
registryKey, not checked against the registry - Since:
- 0.1.0
-
resource
Returns a value ofregistryKey, resolved when parsed; suggested by the client.- Type Parameters:
T- the registry value type- Parameters:
registryKey- the registry- Returns:
- a value of
registryKey, resolved when parsed; suggested by the client - Since:
- 0.1.0
-
serverResource
Returns a value ofregistryKey, resolved when parsed; validated and suggested by the server.- Type Parameters:
T- the registry value type- Parameters:
registryKey- the registry- Returns:
- a value of
registryKey, resolved when parsed; validated and suggested by the server - Since:
- 0.1.0
- API Note:
- Sent to clients as
resourceKey(RegistryKey), forregistriesclients don't know.
-
postEffect
com.mojang.brigadier.arguments.ArgumentType<Key> postEffect()Returns a post effect; players are suggested those of their loaded resource packs when possible.- Returns:
- a post effect; players are suggested those of their loaded resource packs when possible
- Since:
- 0.1.0
-
nbtPath
com.mojang.brigadier.arguments.ArgumentType<NbtPath> nbtPath()Returns an NBT path.- Returns:
- an NBT path
- Since:
- 0.1.0
-
map
<N,T> com.mojang.brigadier.arguments.ArgumentType<T> map(com.mojang.brigadier.arguments.ArgumentType<N> nativeType, ArgumentMapper<N, T> mapper) ReturnsnativeType, its parsed value converted bymapper.Keeps the native type's client-side grammar, highlighting and suggestions.
- Type Parameters:
N- the native value typeT- the mapped value type- Parameters:
nativeType- the type providing grammar and suggestionsmapper- converts the parsed value- Returns:
nativeType, its parsed value converted bymapper- Since:
- 0.1.0
-
map
<N,T> com.mojang.brigadier.arguments.ArgumentType<T> map(com.mojang.brigadier.arguments.ArgumentType<N> nativeType, ArgumentMapper<N, T> mapper, com.mojang.brigadier.suggestion.SuggestionProvider<CommandSource> suggestions) ReturnsnativeType, its parsed value converted bymapperand its suggestions replaced.For when the native grammar fits but its completions don't, like a
StringArgumentType.word()mapped to an enum.- Type Parameters:
N- the native value typeT- the mapped value type- Parameters:
nativeType- the type providing grammarmapper- converts the parsed valuesuggestions- suggestions computed by the server- Returns:
nativeType, its parsed value converted bymapperand its suggestions replaced- Since:
- 0.1.0
-
withServerSuggestions
<T> com.mojang.brigadier.arguments.ArgumentType<T> withServerSuggestions(com.mojang.brigadier.arguments.ArgumentType<T> type) Returnstype, suggested by the server instead of the client.For hand-rolled
parse/listSuggestionslogic.- Type Parameters:
T- the parsed value type- Parameters:
type- the argument type- Returns:
type, suggested by the server instead of the client- Since:
- 0.1.0
-
withClientSuggestions
<T> com.mojang.brigadier.arguments.ArgumentType<T> withClientSuggestions(com.mojang.brigadier.arguments.ArgumentType<T> type, Key suggestionSource, @Nullable com.mojang.brigadier.suggestion.SuggestionProvider<CommandSource> fallbackSuggestions) Returnstype, suggested by the client fromsuggestionSource.When the server has to answer (console, client unaware of the source), it uses
fallbackSuggestions, ortype's own ifnull.- Type Parameters:
T- the parsed value type- Parameters:
type- the argument typesuggestionSource- the client-side suggestion sourcefallbackSuggestions- server-side suggestions, ornull- Returns:
type, suggested by the client fromsuggestionSource- Since:
- 0.1.0
-
withClientSuggestions
<T> com.mojang.brigadier.arguments.ArgumentType<T> withClientSuggestions(com.mojang.brigadier.arguments.ArgumentType<T> type, List<String> values) Returnstype, suggested by the client fromvalues.When the server has to answer, it suggests the same values.
- Type Parameters:
T- the parsed value type- Parameters:
type- the argument typevalues- the suggested values- Returns:
type, suggested by the client fromvalues- Since:
- 0.1.0
-