Package dev.itsharshxd.zentrix.api.world
Record Class SkyDropRequest
java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.world.SkyDropRequest
- Record Components:
anchor- the point to stay near; its world is the world the drop happens inhorizontalRadius- how far from the anchor a point may be chosen, in blocks;0keeps the drop directly above the anchoraltitude- how far above the ground the player should appear, in blocksclearance- how many free blocks have to sit under the drop point, which is what stops a player being handed a glide with nowhere to glideattempts- how many candidate points to try before giving uprequireInsideBorder- whether the point has to lie inside the world's current border
public record SkyDropRequest(@NotNull org.bukkit.Location anchor, double horizontalRadius, int altitude, int clearance, int attempts, boolean requireInsideBorder)
extends Record
Where a player should be put back into the sky above a world.
A request describes an area rather than a point: an anchor to stay near, how far from it a
point may be chosen, how high above the ground the player should appear, and how much free air
has to be underneath them. SkyDropService turns that into an actual location, or into
nothing at all when the area cannot offer one.
Instances are immutable and the anchor is copied on the way in and out, so a request can be held on to and reused across matches without a later teleport changing what it meant.
- Since:
- 1.6.0
-
Constructor Summary
ConstructorsConstructorDescriptionSkyDropRequest(@NotNull org.bukkit.Location anchor, double horizontalRadius, int altitude, int clearance, int attempts, boolean requireInsideBorder) Creates an instance of aSkyDropRequestrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull SkyDropRequestabove(@NotNull org.bukkit.Location anchor) A drop directly above one point, high enough to glide from.intaltitude()Returns the value of thealtituderecord component.org.bukkit.Locationanchor()Returns the value of theanchorrecord component.@NotNull SkyDropRequestatAltitude(int blocks) How far above the ground the player appears.intattempts()Returns the value of theattemptsrecord component.intReturns the value of theclearancerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doubleReturns the value of thehorizontalRadiusrecord component.@NotNull SkyDropRequestinsideBorder(boolean require) Whether the point has to lie inside the world's current border.booleanReturns the value of therequireInsideBorderrecord component.final StringtoString()Returns a string representation of this record class.@NotNull SkyDropRequestwithAttempts(int value) How many candidate points to try before giving up.@NotNull SkyDropRequestwithClearance(int blocks) How much free air the drop point needs beneath it.@NotNull SkyDropRequestwithinRadius(double radius) How far from the anchor a point may be chosen.
-
Constructor Details
-
SkyDropRequest
public SkyDropRequest(@NotNull @NotNull org.bukkit.Location anchor, double horizontalRadius, int altitude, int clearance, int attempts, boolean requireInsideBorder) Creates an instance of aSkyDropRequestrecord class.- Parameters:
anchor- the value for theanchorrecord componenthorizontalRadius- the value for thehorizontalRadiusrecord componentaltitude- the value for thealtituderecord componentclearance- the value for theclearancerecord componentattempts- the value for theattemptsrecord componentrequireInsideBorder- the value for therequireInsideBorderrecord component
-
-
Method Details
-
anchor
public org.bukkit.Location anchor()Returns the value of theanchorrecord component.- Returns:
- the value of the
anchorrecord component
-
above
A drop directly above one point, high enough to glide from.The defaults suit a player re-entering a match from the air; narrow them with the
with*methods rather than calling the canonical constructor. -
withinRadius
How far from the anchor a point may be chosen. -
atAltitude
How far above the ground the player appears. -
withClearance
How much free air the drop point needs beneath it. -
withAttempts
How many candidate points to try before giving up. -
insideBorder
Whether the point has to lie inside the world's current border. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
horizontalRadius
public double horizontalRadius()Returns the value of thehorizontalRadiusrecord component.- Returns:
- the value of the
horizontalRadiusrecord component
-
altitude
public int altitude()Returns the value of thealtituderecord component.- Returns:
- the value of the
altituderecord component
-
clearance
public int clearance()Returns the value of theclearancerecord component.- Returns:
- the value of the
clearancerecord component
-
attempts
public int attempts()Returns the value of theattemptsrecord component.- Returns:
- the value of the
attemptsrecord component
-
requireInsideBorder
public boolean requireInsideBorder()Returns the value of therequireInsideBorderrecord component.- Returns:
- the value of the
requireInsideBorderrecord component
-