Package io.papermc.paper.util

# Class Tick

java.lang.Object
io.papermc.paper.util.Tick

All Implemented Interfaces:
  `TemporalUnit`

public final class Tick extends Object implements TemporalUnit
A TemporalUnit that represents the target length of one server tick. This is defined as 50 milliseconds. Note that this class is not for measuring the length that a tick took, rather it is used for simple conversion between times and ticks.

See Also:
  - `tick()`

## Method Summary

Modifier and Type
Method
Description
`<R extends Temporal>
R`
`addTo(R temporal, long amount)`
`long`
`between(@NotNull Temporal start, @NotNull Temporal end)`
`int`
`fromDuration(@NotNull Duration duration)`
Gets the number of whole ticks that occur in the provided duration.
`@NotNull Duration`
`getDuration()`
`boolean`
`isDateBased()`
`boolean`
`isDurationEstimated()`
`boolean`
`isTimeBased()`
`static @NotNull Duration`
`of(long ticks)`
Creates a duration from an amount of ticks.
`static @NotNull Tick`
`tick()`
Gets the instance of the tick temporal unit.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.time.temporal.TemporalUnit

`isSupportedBy, toString`

## Method Details

### tick

@NotNull public static @NotNull Tick tick()
Gets the instance of the tick temporal unit.

Returns:
  the tick instance

### of

@NotNull public static @NotNull Duration of(long ticks)
Creates a duration from an amount of ticks. This is shorthand for `Duration.of(long, TemporalUnit)` called with the amount of ticks and `tick()`.

Parameters:
  `ticks` - the amount of ticks
Returns:
  the duration

### fromDuration

public int fromDuration(@NotNull @NotNull Duration duration)
Gets the number of whole ticks that occur in the provided duration. Note that this method returns an `int` as this is the unit that Minecraft stores ticks in.

Parameters:
  `duration` - the duration
Returns:
  the number of whole ticks in this duration
Throws:
  `ArithmeticException` - if the duration is zero or an overflow occurs

### getDuration

@NotNull public @NotNull Duration getDuration()

Specified by:
  `getDuration` in interface `TemporalUnit`

### isDurationEstimated

public boolean isDurationEstimated()

Specified by:
  `isDurationEstimated` in interface `TemporalUnit`

### isDateBased

public boolean isDateBased()

Specified by:
  `isDateBased` in interface `TemporalUnit`

### isTimeBased

public boolean isTimeBased()

Specified by:
  `isTimeBased` in interface `TemporalUnit`

### addTo

@NotNull public <R extends Temporal> R addTo(@NotNull R temporal, long amount)

Specified by:
  `addTo` in interface `TemporalUnit`

### between

public long between(@NotNull @NotNull Temporal start, @NotNull @NotNull Temporal end)

Specified by:
  `between` in interface `TemporalUnit`