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 <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 CompletableFuture<String>Gets the value of an option for the given player, falling back to thedefaultValueif nothing is returned from the provider.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 <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 CompletableFuture<String>Gets the value of an option for the given player, falling back to thedefaultValueif nothing is returned from the provider.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 <T> @NotNull Optional<T>get(@NotNull net.minecraft.command.CommandSource 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 StringGets the value of an option for the given source, falling back to thedefaultValueif nothing is returned from the provider.static <T> Tget(@NotNull net.minecraft.command.CommandSource 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.Gets the value of an option for the given entity.static <T> @NotNull Optional<T>get(@NotNull net.minecraft.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 StringGets the value of an option for the given entity, falling back to thedefaultValueif nothing is returned from the provider.static <T> Tget(@NotNull net.minecraft.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
@NotNull static @NotNull Optional<String> get(@NotNull @NotNull net.minecraft.command.CommandSource source, @NotNull @NotNull String key) Gets the value of an option for the given source.- Parameters:
source- the sourcekey- the option key- Returns:
- the option value
-
get
@Contract("_, _, !null -> !null") static String get(@NotNull @NotNull net.minecraft.command.CommandSource source, @NotNull @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.- Parameters:
source- the sourcekey- 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.command.CommandSource source, @NotNull @NotNull String key, @NotNull @NotNull Function<String, ? extends T> valueTransformer) Gets the value of an option for the given source, 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(source, "my-int-value", Integer::parseInt).orElse(0);- Type Parameters:
T- the type of the transformed result- Parameters:
source- the sourcekey- 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.command.CommandSource source, @NotNull @NotNull String key, T defaultValue, @NotNull @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.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(source, "my-int-value", 0, Integer::parseInt);- Type Parameters:
T- the type of the transformed result- Parameters:
source- the sourcekey- the option keydefaultValue- the default valuevalueTransformer- the transformer used to transform the value- Returns:
- the transformed option value
-
get
@NotNull static @NotNull Optional<String> get(@NotNull @NotNull net.minecraft.entity.Entity entity, @NotNull @NotNull String key) Gets the value of an option for the given entity.- Parameters:
entity- the entitykey- the option key- Returns:
- the option value
-
get
@Contract("_, _, !null -> !null") static String get(@NotNull @NotNull net.minecraft.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.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.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
-