mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-01 04:51:29 +01:00
Updated Instance.java
This commit is contained in:
parent
2c9f0c5e67
commit
25183973dc
@ -39,7 +39,6 @@ import net.minestom.server.utils.chunk.ChunkUtils;
|
|||||||
import net.minestom.server.utils.entity.EntityUtils;
|
import net.minestom.server.utils.entity.EntityUtils;
|
||||||
import net.minestom.server.utils.time.Cooldown;
|
import net.minestom.server.utils.time.Cooldown;
|
||||||
import net.minestom.server.utils.time.TimeUnit;
|
import net.minestom.server.utils.time.TimeUnit;
|
||||||
import net.minestom.server.utils.time.UpdateOption;
|
|
||||||
import net.minestom.server.utils.validate.Check;
|
import net.minestom.server.utils.validate.Check;
|
||||||
import net.minestom.server.world.DimensionType;
|
import net.minestom.server.world.DimensionType;
|
||||||
import org.jetbrains.annotations.ApiStatus;
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
@ -47,6 +46,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jglrxavpok.hephaistos.nbt.NBTCompound;
|
import org.jglrxavpok.hephaistos.nbt.NBTCompound;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
@ -80,7 +80,7 @@ public abstract class Instance implements BlockModifier, Tickable, TagHandler, P
|
|||||||
// The time of the instance
|
// The time of the instance
|
||||||
private long time;
|
private long time;
|
||||||
private int timeRate = 1;
|
private int timeRate = 1;
|
||||||
private UpdateOption timeUpdate = new UpdateOption(1, TimeUnit.SECOND);
|
private Duration timeUpdate = Duration.of(1, TimeUnit.SECOND);
|
||||||
private long lastTimeUpdate;
|
private long lastTimeUpdate;
|
||||||
|
|
||||||
// Field for tick events
|
// Field for tick events
|
||||||
@ -416,7 +416,7 @@ public abstract class Instance implements BlockModifier, Tickable, TagHandler, P
|
|||||||
* @return the client update rate for time related packet
|
* @return the client update rate for time related packet
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public UpdateOption getTimeUpdate() {
|
public Duration getTimeUpdate() {
|
||||||
return timeUpdate;
|
return timeUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,7 +428,21 @@ public abstract class Instance implements BlockModifier, Tickable, TagHandler, P
|
|||||||
*
|
*
|
||||||
* @param timeUpdate the new update rate concerning time
|
* @param timeUpdate the new update rate concerning time
|
||||||
*/
|
*/
|
||||||
public void setTimeUpdate(@Nullable UpdateOption timeUpdate) {
|
@SuppressWarnings("removal")
|
||||||
|
@Deprecated(forRemoval = true)
|
||||||
|
public void setTimeUpdate(@Nullable net.minestom.server.utils.time.UpdateOption timeUpdate) {
|
||||||
|
setTimeUpdate(timeUpdate.toDuration());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the rate at which the client is updated about the time
|
||||||
|
* <p>
|
||||||
|
* Setting it to null means that the client will never know about time change
|
||||||
|
* (but will still change server-side)
|
||||||
|
*
|
||||||
|
* @param timeUpdate the new update rate concerning time
|
||||||
|
*/
|
||||||
|
public void setTimeUpdate(@Nullable Duration timeUpdate) {
|
||||||
this.timeUpdate = timeUpdate;
|
this.timeUpdate = timeUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user