All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minestom.server.event.instance.InstanceTickEvent Maven / Gradle / Ivy

There is a newer version: 7320437640
Show newest version
package net.minestom.server.event.instance;

import net.minestom.server.event.trait.InstanceEvent;
import net.minestom.server.instance.Instance;
import org.jetbrains.annotations.NotNull;

/**
 * Called when an instance processes a tick.
 */
public class InstanceTickEvent implements InstanceEvent {

    private final Instance instance;
    private final int duration;

    public InstanceTickEvent(@NotNull Instance instance, long time, long lastTickAge) {
        this.instance = instance;
        this.duration = (int) (time - lastTickAge);
    }

    @Override
    public @NotNull Instance getInstance() {
        return instance;
    }

    /**
     * Gets the duration of the tick in ms.
     *
     * @return the duration
     */
    public int getDuration() {
        return duration;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy