Record Class OffsetProviderContext
java.lang.Object
java.lang.Record
com.jtprince.coordinateoffset.provider.OffsetProviderContext
- Record Components:
player- The Player that will receive this new Offset.previousLocation- The previous location of the Player before this Offset begins to take effect. If the player is joining the server or the death location is unknown for a respawn, this will benull.playerLocation- The real location that the Player will be at as soon as this Offset begins to take effect. Note that this may be different fromplayer.getLocation()because the Provider is called before a teleport completes.reason- The reason that a new Offset is being requested.
@NullMarked
public record OffsetProviderContext(OffsetPlayer player, @Nullable OffsetLocation previousLocation, OffsetLocation playerLocation, @Nullable Offset previousOffset, OffsetProviderContext.ProvideReason reason)
extends Record
Container for relevant information when calculating a new
Offset.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionOffsetProviderContext(OffsetPlayer player, @Nullable OffsetLocation previousLocation, OffsetLocation playerLocation, @Nullable Offset previousOffset, OffsetProviderContext.ProvideReason reason) Creates an instance of aOffsetProviderContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.player()Returns the value of theplayerrecord component.Returns the value of theplayerLocationrecord component.@Nullable OffsetLocationReturns the value of thepreviousLocationrecord component.@Nullable OffsetReturns the value of thepreviousOffsetrecord component.reason()Returns the value of thereasonrecord component.final StringtoString()Returns a string representation of this record class.Deprecated.
-
Constructor Details
-
OffsetProviderContext
public OffsetProviderContext(OffsetPlayer player, @Nullable OffsetLocation previousLocation, OffsetLocation playerLocation, @Nullable Offset previousOffset, OffsetProviderContext.ProvideReason reason) Creates an instance of aOffsetProviderContextrecord class.- Parameters:
player- the value for theplayerrecord componentpreviousLocation- the value for thepreviousLocationrecord componentplayerLocation- the value for theplayerLocationrecord componentpreviousOffset- the value for thepreviousOffsetrecord componentreason- the value for thereasonrecord component
-
-
Method Details
-
worldName
Deprecated.UseplayerLocation()-OffsetLocation.getWorld()instead. -
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. All components in this record class are compared withObjects::equals(Object,Object). -
player
Returns the value of theplayerrecord component.- Returns:
- the value of the
playerrecord component
-
previousLocation
Returns the value of thepreviousLocationrecord component.- Returns:
- the value of the
previousLocationrecord component
-
playerLocation
Returns the value of theplayerLocationrecord component.- Returns:
- the value of the
playerLocationrecord component
-
previousOffset
Returns the value of thepreviousOffsetrecord component.- Returns:
- the value of the
previousOffsetrecord component
-
reason
Returns the value of thereasonrecord component.- Returns:
- the value of the
reasonrecord component
-
playerLocation()-OffsetLocation.getWorld()instead.