Class HorseUtils
java.lang.Object
net.slommy.utils.HorseUtils
Helper utilities for Horse Construction and API calls
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CompletableFuture<Boolean> changeHorseOwner(net.minestom.server.entity.Player player, com.google.gson.JsonObject horseObject) Makes a request to the horse API patching the ownership of a horse to a player's UUIDstatic net.minestom.server.entity.EntityTypegetEntityTypeFromString(String entityType) static CompletableFuture<HorseResponseArray> getHorseArray(String requestUrl) Helper method to get an Array of horses from the API.static CompletableFuture<com.google.gson.JsonObject> getHorseObject(String desiredHorseName) Helper method to get a horse JSON object from the horse's namestatic StringgetHorseSizeString(double size) getHorseStatRolls(com.google.gson.JsonObject horseObject) getHorseStats(com.google.gson.JsonObject horseObject) static net.minestom.server.entity.metadata.animal.HorseMeta.VariantgetVariantFromString(String variant) static StringhorseEvaluatorString(List<Integer> rollArray)
-
Constructor Details
-
HorseUtils
public HorseUtils()
-
-
Method Details
-
getHorseSizeString
-
getVariantFromString
public static net.minestom.server.entity.metadata.animal.HorseMeta.Variant getVariantFromString(String variant) -
getEntityTypeFromString
-
getHorseObject
Helper method to get a horse JSON object from the horse's name- Parameters:
desiredHorseName- The name of the horse to find in the database- Returns:
- Async JSON object representing the horse that the API responded with.
-
getHorseArray
Helper method to get an Array of horses from the API. Used when sending a request that expects multiple horses in response- Parameters:
requestUrl- The route that is being requested. i.e. /horse/all?page=1- Returns:
- Async HorseResponseArray object containing the array of horses as well as pagination information.
-
changeHorseOwner
public static CompletableFuture<Boolean> changeHorseOwner(net.minestom.server.entity.Player player, com.google.gson.JsonObject horseObject) Makes a request to the horse API patching the ownership of a horse to a player's UUID- Parameters:
player- The new owner of the horsehorseObject- The JSON object representing the horse- Returns:
- Async boolean representing the success of the Request
-
getHorseStats
-
getHorseStatRolls
-
horseEvaluatorString
-