Class NumberStylizer

java.lang.Object
com.ryandw11.structure.utils.NumberStylizer

public final class NumberStylizer extends Object
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 Details

    • NumberStylizer

      public NumberStylizer()
  • Method Details

    • getStylizedInt

      public static int getStylizedInt(String input)
      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

      public static Pair<Integer,​Integer> parseRangedInput(String input)
      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

      public static int retrieveRangedInput(String input)
      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.