Class LocationUtil
java.lang.Object
net.mathias2246.buildmc.util.LocationUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcalculateChunkArea(int chunkX1, int chunkZ1, int chunkX2, int chunkZ2) static intcalculateChunkArea(@NotNull org.bukkit.Location pos1, @NotNull org.bukkit.Location pos2) Calculates the number of chunks covered by the area defined by two positions.static @NotNull org.bukkit.Locationdeserialize(String data) Deserialize a String back into a Location.static Stringserialize(org.bukkit.Location location) Serialize a Location into a String.static @Nullable org.bukkit.LocationtryDeserialize(String data) Deserialize a String back into a Location.
-
Constructor Details
-
LocationUtil
public LocationUtil()
-
-
Method Details
-
serialize
Serialize a Location into a String. Format: world,x,y,z,yaw,pitch- Parameters:
location- the Location to serialize- Returns:
- serialized String
-
deserialize
Deserialize a String back into a Location. Must match the format from serialize()- Parameters:
data- the serialized string- Returns:
- Location object
-
tryDeserialize
Deserialize a String back into a Location. Must match the format from serialize()- Parameters:
data- the serialized string- Returns:
- Location object, or null is failed
-
calculateChunkArea
public static int calculateChunkArea(@NotNull @NotNull org.bukkit.Location pos1, @NotNull @NotNull org.bukkit.Location pos2) Calculates the number of chunks covered by the area defined by two positions. Both positions must be in the same world.- Parameters:
pos1- First corner locationpos2- Second corner location- Returns:
- Number of chunks in the rectangular selection
-
calculateChunkArea
public static int calculateChunkArea(int chunkX1, int chunkZ1, int chunkX2, int chunkZ2)
-