Package com.plotsquared.core.location
Class Location
java.lang.Object
com.plotsquared.core.location.BlockLoc
com.plotsquared.core.location.Location
- All Implemented Interfaces:
Comparable<Location>
- Direct Known Subclasses:
UncheckedWorldLocation
public sealed class Location
extends BlockLoc
implements Comparable<Location>
permits UncheckedWorldLocation
An unmodifiable 6-tuple (world,x,y,z,yaw,pitch)
-
Field Summary
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLocation(@NonNull World<?> world, @NonNull BlockVector3 blockVector3, float yaw, float pitch) -
Method Summary
Modifier and TypeMethodDescription@NonNull Locationadd(int x, int y, int z) Return a new location offset by the given coordinatesstatic @NonNull LocationConstruct a new location with yaw and pitch equal to 0static @NonNull LocationConstruct a new locationstatic @NonNull Locationat(@NonNull World<?> world, @NonNull BlockVector3 blockVector3) Construct a new location with yaw and pitch equal to 0static @NonNull Locationat(@NonNull World<?> world, @NonNull BlockVector3 blockVector3, float yaw, float pitch) Construct a new locationstatic @NonNull LocationConstruct a new location with yaw and pitch equal to 0static @NonNull LocationConstruct a new locationstatic @NonNull Locationat(@NonNull String world, @NonNull BlockVector3 blockVector3) Construct a new location with yaw and pitch equal to 0static @NonNull Locationat(@NonNull String world, @NonNull BlockVector3 blockVector3, float yaw, float pitch) Construct a new locationintboolean@NonNull BlockVector2Get the coordinates of the chunk that contains this locationdoublegetEuclideanDistance(@NonNull Location l2) doublegetEuclideanDistanceSquared(@NonNull Location l2) @Nullable PlotGet the ownedPlot, if any, that contains this location@Nullable PlotGet the (absolute) ownedPlot, if any, that contains this locationfloatgetPitch()@Nullable PlotgetPlot()Get thePlot, if any, that contains this location@Nullable PlotGet the absolutePlot, if any, that contains this location@Nullable PlotAreaGet thePlotArea, if any, that contains this location@NonNull World<?>getWorld()Get the world object@NonNull StringGet the name of the world this location is inintgetX()Get the X coordinateintgetY()Get the Y coordinatefloatgetYaw()intgetZ()Get the Z coordinateinthashCode()booleanCheck whether the location belongs to a plot areabooleanCheck whether the location belongs to a plot roadbooleanChecks if anyone owns a plot at the current location.@NonNull Locationsubtract(int x, int y, int z) Return a new location offset by (-) the given coordinates@NonNull org.khelekore.prtree.MBRtoMBR()Get a minimum bounding rectangle that contains this location onlytoString()@NonNull LocationwithPitch(float pitch) Return a new location using the given pitch@NonNull LocationReturn a new location using the given world@NonNull LocationwithX(int x) Return a new location using the given X coordinate@NonNull LocationwithY(int y) Return a new location using the given Y coordinate@NonNull LocationwithYaw(float yaw) Return a new location using the given yaw@NonNull LocationwithZ(int z) Return a new location using the given Z coordinateMethods inherited from class com.plotsquared.core.location.BlockLoc
fromString
-
Constructor Details
-
Location
protected Location(@NonNull World<?> world, @NonNull BlockVector3 blockVector3, float yaw, float pitch) - Since:
- 6.9.0
-
-
Method Details
-
at
public static @NonNull Location at(@NonNull String world, @NonNull BlockVector3 blockVector3, float yaw, float pitch) Construct a new location- Parameters:
world- WorldblockVector3- (x,y,z) vectoryaw- yawpitch- pitch- Returns:
- New location
-
at
Construct a new location with yaw and pitch equal to 0- Parameters:
world- WorldblockVector3- (x,y,z) vector- Returns:
- New location
-
at
public static @NonNull Location at(@NonNull String world, int x, int y, int z, float yaw, float pitch) Construct a new location- Parameters:
world- Worldx- X coordinatey- Y coordinatez- Z coordinateyaw- Yawpitch- Pitch- Returns:
- New location
-
at
Construct a new location with yaw and pitch equal to 0- Parameters:
world- Worldx- X coordinatey- Y coordinatez- Z coordinate- Returns:
- New location
-
at
public static @NonNull Location at(@NonNull World<?> world, @NonNull BlockVector3 blockVector3, float yaw, float pitch) Construct a new location- Parameters:
world- WorldblockVector3- (x,y,z) vectoryaw- yawpitch- pitch- Returns:
- New location
-
at
Construct a new location with yaw and pitch equal to 0- Parameters:
world- WorldblockVector3- (x,y,z) vector- Returns:
- New location
-
at
public static @NonNull Location at(@NonNull World<?> world, int x, int y, int z, float yaw, float pitch) Construct a new location- Parameters:
world- Worldx- X coordinatey- Y coordinatez- Z coordinateyaw- Yawpitch- Pitch- Returns:
- New location
-
at
Construct a new location with yaw and pitch equal to 0- Parameters:
world- Worldx- X coordinatey- Y coordinatez- Z coordinate- Returns:
- New location
-
getWorld
Get the world object- Returns:
- World object
-
getWorldName
Get the name of the world this location is in- Returns:
- World name
-
getX
Get the X coordinate -
getY
Get the Y coordinate -
getZ
Get the Z coordinate -
getPlotArea
Get thePlotArea, if any, that contains this location- Returns:
- Plot area containing the location, or
null
-
getOwnedPlot
Get the ownedPlot, if any, that contains this location- Returns:
- Plot containing the location, or
null
-
getOwnedPlotAbs
Get the (absolute) ownedPlot, if any, that contains this location- Returns:
- (Absolute) plot containing the location, or
null
-
isPlotArea
Check whether the location belongs to a plot area- Returns:
trueif the location belongs to a plot area, elsefalse
-
isPlotRoad
Check whether the location belongs to a plot road- Returns:
trueif the location belongs to a plot road, elsefalse
-
isUnownedPlotArea
Checks if anyone owns a plot at the current location.- Returns:
trueif the location is a road, not a plot area, or if the plot is unclaimed.
-
getPlotAbs
Get the absolutePlot, if any, that contains this location- Returns:
- (Absolute) plot containing the location, or
null
-
getPlot
Get thePlot, if any, that contains this location- Returns:
- plot containing the location, or
null
-
getChunkLocation
Get the coordinates of the chunk that contains this location- Returns:
- Chunk coordinates
-
add
Return a new location offset by the given coordinates- Parameters:
x- X offsety- Y offsetz- Z offset- Returns:
- New location
-
withX
Return a new location using the given X coordinate- Parameters:
x- New X coordinate- Returns:
- New location
-
withY
Return a new location using the given Y coordinate- Parameters:
y- New Y coordinate- Returns:
- New location
-
withZ
Return a new location using the given Z coordinate- Parameters:
z- New Z coordinate- Returns:
- New location
-
withYaw
Return a new location using the given yaw- Parameters:
yaw- New yaw- Returns:
- New location
-
withPitch
Return a new location using the given pitch- Parameters:
pitch- New pitch- Returns:
- New location
-
withWorld
Return a new location using the given world- Parameters:
world- New world- Returns:
- New location
-
getEuclideanDistanceSquared
-
getEuclideanDistance
-
subtract
Return a new location offset by (-) the given coordinates- Parameters:
x- X offsety- Y offsetz- Z offset- Returns:
- New location
-
toMBR
Get a minimum bounding rectangle that contains this location only- Returns:
- Minimum bounding rectangle
-
compareTo
- Specified by:
compareToin interfaceComparable<Location>
-
equals
-
hashCode
-
toString
-
getYaw
-
getPitch
-
getBlockVector3
-