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

Code before:

    /**
     * Sets the new size of the world border.
     *
     * @param newSize the new size
     */
    public void setNewSize(final double newSize) {
        this.newSize = Math.min(this.worldBorder.getMaxSize(), Math.max(1.0D, newSize));
    }

    /**
     * Gets the time in ticks for the change. Will be 0 if instant.
     *
     * @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 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 = duration;
        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 deprecated in favor of {@link #setDurationTicks(long)}
     */
    @Deprecated(forRemoval = true, since = "1.21.11")

Review comment (bug):
Might still clamp the minimum value to 0, ideally it would fail in a preconditions but that's a breaking change i guess.
Do you know for which reason the duration was clamped to 9223372036854775 ? (cause at least it should be consistent with the setter in WorldBorder.

Code after:
    }

    /**
     * Sets the new size of the world border.
     *
     * @param newSize the new size
     */
    public void setNewSize(final double newSize) {
        this.newSize = Math.min(this.worldBorder.getMaxSize(), Math.max(1.0D, newSize));
    }

    /**
     * Gets the time in ticks for the change. Will be 0 if instant.
     *
     * @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)}
     */