Class FormatUtil


public class FormatUtil extends Object
Provides utilities for parsing various string formats.
  • Constructor Details

    • FormatUtil

      public FormatUtil()
  • Method Details

    • parseLocationString

      public static @Nullable org.bukkit.Location parseLocationString(@NonNull String string, @Nullable org.bukkit.World world)
      Parses a string in the location format. The world value is used to construct the Bukkit location.

      The location format can be used to define a Bukkit location as a string given the X, Y, Z, and optionally, yaw, and pitch of a location.

      The location format is "X;Y;Z;YAW;PITCH". Please note, that PITCH and YAW may be excluded, but they must be excluded together. If you add PITCH, you must also define YAW.

      If the string passed to this method is not a comma-delimited list with 3 or 5 entries, then a null value will be returned.

      string - the format string
      world - the world
      the parsed location.
    • asLocationString

      public static @NonNull String asLocationString(@NonNull org.bukkit.Location location)
      Constructs a location string from the provided location. If yaw and pitch are zero, then they will be excluded from the generated string.
      location - the location
      a string representing the location