Package dev.piglin.piglinworldapi.util
Record Class TeleportUtils.TimedTeleportRecord<M>
java.lang.Object
java.lang.Record
dev.piglin.piglinworldapi.util.TeleportUtils.TimedTeleportRecord<M>
- Type Parameters:
M- The additional metadata for your needs- Record Components:
player- The playerdestination- The destinationtime- Timestamp when the player shouldonCancel- Will be executed when the player moves Note: Object is always instanceof Meta but I don't know javaonTeleport- Will be executed when the player should teleport. Note: Object is always instanceof Meta but I don't know java Returns: true = teleport, false = cancel
- Enclosing class:
- TeleportUtils
public static record TeleportUtils.TimedTeleportRecord<M>(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.Location destination, long time, @NotNull Consumer<TeleportUtils.TimedTeleportRecord<Object>> onCancel, @NotNull Function<TeleportUtils.TimedTeleportRecord<Object>,Boolean> onTeleport, M meta)
extends Record
A timed teleport description
-
Field Summary
FieldsModifier and TypeFieldDescriptionAlways teleport player (for onTeleport)Do nothing when cancelled (for onCancel) -
Constructor Summary
ConstructorsConstructorDescriptionTimedTeleportRecord(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.Location destination, long time, @NotNull Consumer<TeleportUtils.TimedTeleportRecord<Object>> onCancel, @NotNull Function<TeleportUtils.TimedTeleportRecord<Object>,Boolean> onTeleport, M meta)Creates an instance of aTimedTeleportRecordrecord class.TimedTeleportRecord(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.Location destination, @NotNull Consumer<TeleportUtils.TimedTeleportRecord<Object>> onCancel, @NotNull Function<TeleportUtils.TimedTeleportRecord<Object>,Boolean> onTeleport, M meta) -
Method Summary
Modifier and TypeMethodDescription@NotNull org.bukkit.LocationReturns the value of thedestinationrecord component.booleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.meta()Returns the value of themetarecord component.@NotNull Consumer<TeleportUtils.TimedTeleportRecord<Object>>onCancel()Returns the value of theonCancelrecord component.@NotNull Function<TeleportUtils.TimedTeleportRecord<Object>,Boolean>Returns the value of theonTeleportrecord component.@NotNull org.bukkit.entity.Playerplayer()Returns the value of theplayerrecord component.longtime()Returns the value of thetimerecord component.toString()Returns a string representation of this record class.
-
Field Details
-
ALWAYS_TELEPORT
Always teleport player (for onTeleport) -
NOOP
Do nothing when cancelled (for onCancel)
-
-
Constructor Details
-
TimedTeleportRecord
public TimedTeleportRecord(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.Location destination, @NotNull @NotNull Consumer<TeleportUtils.TimedTeleportRecord<Object>> onCancel, @NotNull @NotNull Function<TeleportUtils.TimedTeleportRecord<Object>,Boolean> onTeleport, @Nullable M meta) -
TimedTeleportRecord
public TimedTeleportRecord(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.Location destination, long time, @NotNull @NotNull Consumer<TeleportUtils.TimedTeleportRecord<Object>> onCancel, @NotNull @NotNull Function<TeleportUtils.TimedTeleportRecord<Object>,Boolean> onTeleport, @Nullable M meta)Creates an instance of aTimedTeleportRecordrecord class.- Parameters:
player- the value for theplayerrecord componentdestination- the value for thedestinationrecord componenttime- the value for thetimerecord componentonCancel- the value for theonCancelrecord componentonTeleport- the value for theonTeleportrecord componentmeta- the value for themetarecord component
-
-
Method Details
-
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 '=='. -
player
@NotNull public @NotNull org.bukkit.entity.Player player()Returns the value of theplayerrecord component.- Returns:
- the value of the
playerrecord component
-
destination
@NotNull public @NotNull org.bukkit.Location destination()Returns the value of thedestinationrecord component.- Returns:
- the value of the
destinationrecord component
-
time
public long time()Returns the value of thetimerecord component.- Returns:
- the value of the
timerecord component
-
onCancel
Returns the value of theonCancelrecord component.- Returns:
- the value of the
onCancelrecord component
-
onTeleport
Returns the value of theonTeleportrecord component.- Returns:
- the value of the
onTeleportrecord component
-
meta
Returns the value of themetarecord component.- Returns:
- the value of the
metarecord component
-