Class FormatUtil
java.lang.Object
com.gamersafer.minecraft.auth.paper.util.FormatUtil
Provides utilities for parsing various string formats.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull String
asLocationString
(@NonNull org.bukkit.Location location) Constructs a location string from the provided location.static @Nullable org.bukkit.Location
parseLocationString
(@NonNull String string, @Nullable org.bukkit.World world) Parses a string in the location format.
-
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.
- Parameters:
string
- the format stringworld
- the world- Returns:
- the parsed location.
-
asLocationString
Constructs a location string from the provided location. If yaw and pitch are zero, then they will be excluded from the generated string.- Parameters:
location
- the location- Returns:
- a string representing the location
-