Repository: PaperMC/Paper
File: paper-api/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java (Java)

Code before:
     * @return the time in ticks for the change
     */
    public long getDurationTicks() {
        return this.duration;
    }

    /**
     * Gets the time in milliseconds for the change. Will be 0 if instant.
     *
     * @return the time in milliseconds for the change
     * @deprecated in favor of {@link #getDurationTicks()}
     */
    @Deprecated(forRemoval = true, since = "1.21.11")
    public long getDuration() {
        return Tick.of(this.duration).toMillis();
    }

    /**
     * Sets the time in ticks for the change. Will change {@link #getType()} to return
     * {@link Type#STARTED_MOVE}.
     *
     * @param duration the time in ticks for the change
     */
    public void setDurationTicks(final long duration) {
        this.duration = Math.clamp(duration, 0L, Integer.MAX_VALUE);
        if (duration >= 0 && this.type == Type.INSTANT_MOVE) {
            this.type = Type.STARTED_MOVE;
        }
    }

    /**
     * Sets the time in milliseconds for the change. Will change {@link #getType()} to return
     * {@link Type#STARTED_MOVE}.
     *
     * @param duration the time in milliseconds for the change
     * @deprecated in favor of {@link #setDurationTicks(long)}
     */
    @Deprecated(forRemoval = true, since = "1.21.11")
    public void setDuration(final long duration) {
        this.setDurationTicks(Tick.tick().fromDuration(Duration.ofMillis(Math.clamp(duration, 0L, Integer.MAX_VALUE))));
    }

    @Override
    public boolean isCancelled() {
        return this.cancelled;
    }

    @Override
    public void setCancelled(final boolean cancel) {
        this.cancelled = cancel;
    }

Review comment (suggestion):
Might as well change the param to be an int if we really want to respect the command limit then just clamp the other method (but only the result of the conversion).

Code after:
     *
     * @return the time in ticks for the change
     */
    public long getDurationTicks() {
        return this.duration;
    }

    /**
     * Gets the time in milliseconds for the change. Will be 0 if instant.
     *
     * @return the time in milliseconds for the change
     * @deprecated in favor of {@link #getDurationTicks()}
     */
    @Deprecated(forRemoval = true, since = "1.21.11")
    public long getDuration() {
        return Tick.of(this.duration).toMillis();
    }

    /**
     * Sets the time in ticks for the change. Will change {@link #getType()} to return
     * {@link Type#STARTED_MOVE}.
     *
     * @param duration the time in ticks for the change
     */
    public void setDurationTicks(@Range(from = 0, to = Integer.MAX_VALUE) final long duration) {
        this.duration = Math.clamp(duration, 0L, Integer.MAX_VALUE);
        if (this.type == Type.INSTANT_MOVE) {
            this.type = Type.STARTED_MOVE;
        }
    }

    /**
     * Sets the time in milliseconds for the change. Will change {@link #getType()} to return
     * {@link Type#STARTED_MOVE}.
     *
     * @param duration the time in milliseconds for the change
     * @deprecated in favor of {@link #setDurationTicks(long)}
     */
    @Deprecated(forRemoval = true, since = "1.21.11")
    public void setDuration(final long duration) {
        this.setDurationTicks(Tick.tick().fromDuration(Duration.ofMillis(Math.clamp(duration, 0L, Integer.MAX_VALUE))));
    }

    @Override
    public boolean isCancelled() {
        return this.cancelled;
    }

    @Override
    public void setCancelled(final boolean cancel) {
        this.cancelled = cancel;