Interface Options
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic @NotNull CompletableFuture<Optional<String>> Gets the value of an option for the given (potentially) offline player.static CompletableFuture<String> Gets the value of an option for the given player, falling back to thedefaultValueif nothing is returned from the provider.static <T> @NotNull CompletableFuture<Optional<T>> get(@NotNull com.mojang.authlib.GameProfile profile, @NotNull String key, @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given player, and runs it through the givenvalueTransformer.static <T> CompletableFuture<T> get(@NotNull com.mojang.authlib.GameProfile profile, @NotNull String key, T defaultValue, @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given player, runs it through the givenvalueTransformer, and falls back to thedefaultValueif nothing is returned.static @NotNull CompletableFuture<Optional<String>> Gets the value of an option for the given (potentially) offline player.static CompletableFuture<String> Gets the value of an option for the given player, falling back to thedefaultValueif nothing is returned from the provider.static <T> @NotNull CompletableFuture<Optional<T>> get(@NotNull UUID uuid, @NotNull String key, @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given player, and runs it through the givenvalueTransformer.static <T> CompletableFuture<T> get(@NotNull UUID uuid, @NotNull String key, T defaultValue, @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given player, runs it through the givenvalueTransformer, and falls back to thedefaultValueif nothing is returned.Gets the value of an option for the given source.static Stringget(@NotNull net.minecraft.commands.SharedSuggestionProvider source, @NotNull String key, String defaultValue) Gets the value of an option for the given source, falling back to thedefaultValueif nothing is returned from the provider.static <T> @NotNull Optional<T> get(@NotNull net.minecraft.commands.SharedSuggestionProvider source, @NotNull String key, @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given source, and runs it through the givenvalueTransformer.static <T> Tget(@NotNull net.minecraft.commands.SharedSuggestionProvider source, @NotNull String key, T defaultValue, @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given source, runs it through the givenvalueTransformer, and falls back to thedefaultValueif nothing is returned.static @NotNull CompletableFuture<Optional<String>> Gets the value of an option for the given (potentially) offline player.static CompletableFuture<String> get(@NotNull net.minecraft.server.players.NameAndId entry, @NotNull String key, String defaultValue) Gets the value of an option for the given player, falling back to thedefaultValueif nothing is returned from the provider.static <T> @NotNull CompletableFuture<Optional<T>> get(@NotNull net.minecraft.server.players.NameAndId entry, @NotNull String key, @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given player, and runs it through the givenvalueTransformer.static <T> CompletableFuture<T> get(@NotNull net.minecraft.server.players.NameAndId entry, @NotNull String key, T defaultValue, @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given player, runs it through the givenvalueTransformer, and falls back to thedefaultValueif nothing is returned.Gets the value of an option for the given entity.static StringGets the value of an option for the given entity, falling back to thedefaultValueif nothing is returned from the provider.static <T> @NotNull Optional<T> get(@NotNull net.minecraft.world.entity.Entity entity, @NotNull String key, @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given entity, and runs it through the givenvalueTransformer.static <T> Tget(@NotNull net.minecraft.world.entity.Entity entity, @NotNull String key, T defaultValue, @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given entity, runs it through the givenvalueTransformer, and falls back to thedefaultValueif nothing is returned.
-
Method Details
-
get
-
get
@Contract("_, _, !null -> !null") static String get(@NotNull @NotNull net.minecraft.world.entity.Entity entity, @NotNull @NotNull String key, String defaultValue) Gets the value of an option for the given entity, falling back to thedefaultValueif nothing is returned from the provider.- Parameters:
entity- the entitykey- the option keydefaultValue- the default value to use if nothing is returned- Returns:
- the option value
-
get
@NotNull static <T> @NotNull Optional<T> get(@NotNull @NotNull net.minecraft.world.entity.Entity entity, @NotNull @NotNull String key, @NotNull @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given entity, and runs it through the givenvalueTransformer.If nothing is returned from the provider, an
empty optionalis returned. (the transformer will never be passed a null argument)The transformer is allowed to throw
IllegalArgumentExceptionor return null. This will also result in anempty optionalbeing returned.For example, to parse and return an integer meta value, use:
get(entity, "my-int-value", Integer::parseInt).orElse(0);- Type Parameters:
T- the type of the transformed result- Parameters:
entity- the entitykey- the option keyvalueTransformer- the transformer used to transform the value- Returns:
- the transformed option value
-
get
@Contract("_, _, !null, _ -> !null") static <T> T get(@NotNull @NotNull net.minecraft.world.entity.Entity entity, @NotNull @NotNull String key, T defaultValue, @NotNull @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given entity, runs it through the givenvalueTransformer, and falls back to thedefaultValueif nothing is returned.If nothing is returned from the provider, the
defaultValueis returned. (the transformer will never be passed a null argument)The transformer is allowed to throw
IllegalArgumentExceptionor return null. This will also result in thedefaultValuebeing returned.For example, to parse and return an integer meta value, use:
get(entity, "my-int-value", 0, Integer::parseInt);- Type Parameters:
T- the type of the transformed result- Parameters:
entity- the entitykey- the option keydefaultValue- the default valuevalueTransformer- the transformer used to transform the value- Returns:
- the transformed option value
-
get
@NotNull static @NotNull CompletableFuture<Optional<String>> get(@NotNull @NotNull UUID uuid, @NotNull @NotNull String key) Gets the value of an option for the given (potentially) offline player.- Parameters:
uuid- the uuid of the playerkey- the option key- Returns:
- the option value
-
get
@Contract("_, _, !null -> !null") static CompletableFuture<String> get(@NotNull @NotNull UUID uuid, @NotNull @NotNull String key, String defaultValue) Gets the value of an option for the given player, falling back to thedefaultValueif nothing is returned from the provider.- Parameters:
uuid- the uuid of the playerkey- the option keydefaultValue- the default value to use if nothing is returned- Returns:
- the option value
-
get
@NotNull static <T> @NotNull CompletableFuture<Optional<T>> get(@NotNull @NotNull UUID uuid, @NotNull @NotNull String key, @NotNull @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given player, and runs it through the givenvalueTransformer.If nothing is returned from the provider, an
empty optionalis returned. (the transformer will never be passed a null argument)The transformer is allowed to throw
IllegalArgumentExceptionor return null. This will also result in anempty optionalbeing returned.For example, to parse and return an integer meta value, use:
get(uuid, "my-int-value", Integer::parseInt).orElse(0);- Type Parameters:
T- the type of the transformed result- Parameters:
uuid- the uuid of the playerkey- the option keyvalueTransformer- the transformer used to transform the value- Returns:
- the transformed option value
-
get
@Contract("_, _, !null, _ -> !null") static <T> CompletableFuture<T> get(@NotNull @NotNull UUID uuid, @NotNull @NotNull String key, T defaultValue, @NotNull @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given player, runs it through the givenvalueTransformer, and falls back to thedefaultValueif nothing is returned.If nothing is returned from the provider, the
defaultValueis returned. (the transformer will never be passed a null argument)The transformer is allowed to throw
IllegalArgumentExceptionor return null. This will also result in thedefaultValuebeing returned.For example, to parse and return an integer meta value, use:
get(uuid, "my-int-value", 0, Integer::parseInt);- Type Parameters:
T- the type of the transformed result- Parameters:
uuid- the uuid of the playerkey- the option keydefaultValue- the default valuevalueTransformer- the transformer used to transform the value- Returns:
- the transformed option value
-
get
@NotNull static @NotNull CompletableFuture<Optional<String>> get(@NotNull @NotNull com.mojang.authlib.GameProfile profile, @NotNull @NotNull String key) Gets the value of an option for the given (potentially) offline player.- Parameters:
profile- the player profilekey- the option key- Returns:
- the option value
-
get
@Contract("_, _, !null -> !null") static CompletableFuture<String> get(@NotNull @NotNull com.mojang.authlib.GameProfile profile, @NotNull @NotNull String key, String defaultValue) Gets the value of an option for the given player, falling back to thedefaultValueif nothing is returned from the provider.- Parameters:
profile- the player profilekey- the option keydefaultValue- the default value to use if nothing is returned- Returns:
- the option value
-
get
@NotNull static <T> @NotNull CompletableFuture<Optional<T>> get(@NotNull @NotNull com.mojang.authlib.GameProfile profile, @NotNull @NotNull String key, @NotNull @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given player, and runs it through the givenvalueTransformer.If nothing is returned from the provider, an
empty optionalis returned. (the transformer will never be passed a null argument)The transformer is allowed to throw
IllegalArgumentExceptionor return null. This will also result in anempty optionalbeing returned.For example, to parse and return an integer meta value, use:
get(uuid, "my-int-value", Integer::parseInt).orElse(0);- Type Parameters:
T- the type of the transformed result- Parameters:
profile- the player profilekey- the option keyvalueTransformer- the transformer used to transform the value- Returns:
- the transformed option value
-
get
@Contract("_, _, !null, _ -> !null") static <T> CompletableFuture<T> get(@NotNull @NotNull com.mojang.authlib.GameProfile profile, @NotNull @NotNull String key, T defaultValue, @NotNull @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given player, runs it through the givenvalueTransformer, and falls back to thedefaultValueif nothing is returned.If nothing is returned from the provider, the
defaultValueis returned. (the transformer will never be passed a null argument)The transformer is allowed to throw
IllegalArgumentExceptionor return null. This will also result in thedefaultValuebeing returned.For example, to parse and return an integer meta value, use:
get(uuid, "my-int-value", 0, Integer::parseInt);- Type Parameters:
T- the type of the transformed result- Parameters:
profile- the player profilekey- the option keydefaultValue- the default valuevalueTransformer- the transformer used to transform the value- Returns:
- the transformed option value
-
get
@NotNull static @NotNull CompletableFuture<Optional<String>> get(@NotNull @NotNull net.minecraft.server.players.NameAndId entry, @NotNull @NotNull String key) Gets the value of an option for the given (potentially) offline player.- Parameters:
entry- the player config entrykey- the option key- Returns:
- the option value
-
get
@Contract("_, _, !null -> !null") static CompletableFuture<String> get(@NotNull @NotNull net.minecraft.server.players.NameAndId entry, @NotNull @NotNull String key, String defaultValue) Gets the value of an option for the given player, falling back to thedefaultValueif nothing is returned from the provider.- Parameters:
entry- the player config entrykey- the option keydefaultValue- the default value to use if nothing is returned- Returns:
- the option value
-
get
@NotNull static <T> @NotNull CompletableFuture<Optional<T>> get(@NotNull @NotNull net.minecraft.server.players.NameAndId entry, @NotNull @NotNull String key, @NotNull @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given player, and runs it through the givenvalueTransformer.If nothing is returned from the provider, an
empty optionalis returned. (the transformer will never be passed a null argument)The transformer is allowed to throw
IllegalArgumentExceptionor return null. This will also result in anempty optionalbeing returned.For example, to parse and return an integer meta value, use:
get(uuid, "my-int-value", Integer::parseInt).orElse(0);- Type Parameters:
T- the type of the transformed result- Parameters:
entry- the player config entrykey- the option keyvalueTransformer- the transformer used to transform the value- Returns:
- the transformed option value
-
get
@Contract("_, _, !null, _ -> !null") static <T> CompletableFuture<T> get(@NotNull @NotNull net.minecraft.server.players.NameAndId entry, @NotNull @NotNull String key, T defaultValue, @NotNull @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given player, runs it through the givenvalueTransformer, and falls back to thedefaultValueif nothing is returned.If nothing is returned from the provider, the
defaultValueis returned. (the transformer will never be passed a null argument)The transformer is allowed to throw
IllegalArgumentExceptionor return null. This will also result in thedefaultValuebeing returned.For example, to parse and return an integer meta value, use:
get(uuid, "my-int-value", 0, Integer::parseInt);- Type Parameters:
T- the type of the transformed result- Parameters:
entry- the player config entrykey- the option keydefaultValue- the default valuevalueTransformer- the transformer used to transform the value- Returns:
- the transformed option value