Package com.ryandw11.structure.utils
Class NumberStylizer
java.lang.Object
com.ryandw11.structure.utils.NumberStylizer
This is the system that allows for a random range or exact numbers to be inputted in the config.
Valid Inputs:
[4;10] --> Picks a random number between 4 and 10. 10 --> The number 10.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
getStylizedInt(String input)
Allows for the input of a random range or an exact number.static int
getStylizedSpawnY(String value, @Nullable org.bukkit.Location location)
Stylize a SpawnY Value.parseRangedInput(String input)
Parse an int range into the lower and upper value.static int
retrieveRangedInput(String input)
Parse an int range and pick a value at random.
-
Constructor Details
-
NumberStylizer
public NumberStylizer()
-
-
Method Details
-
getStylizedInt
Allows for the input of a random range or an exact number.Valid Inputs:
[4;10]
10- Parameters:
input
- The String input.- Returns:
- The number. (If invalid 1 is returned).
-
parseRangedInput
Parse an int range into the lower and upper value.Example Input: [4; 10]
- Parameters:
input
- The String input.- Returns:
- The Pair containing the lower and upper integers of the range.
- Throws:
NumberFormatException
- If the format is not valid or if the first number is greater than the second number.
-
retrieveRangedInput
Parse an int range and pick a value at random.Example Input: [4; 10]
- Parameters:
input
- The String input.- Returns:
- The picked value.
- Throws:
NumberFormatException
- If the format is not valid or if the first number is greater than the second number.
-
getStylizedSpawnY
public static int getStylizedSpawnY(String value, @Nullable @Nullable org.bukkit.Location location)Stylize a SpawnY Value.- Parameters:
value
- The SpawnY Value.location
- The location of the "top" block.- Returns:
- The location of the top block.
-