mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-04 23:47:59 +01:00
Simplified millis calculation
This commit is contained in:
parent
01dfe2f48d
commit
c9dd06ba20
@ -1536,7 +1536,7 @@ public class Entity implements Viewable, Tickable, EventHandler<EntityEvent>, Da
|
||||
this.scheduledRemoveTime = 0;
|
||||
return;
|
||||
}
|
||||
this.scheduledRemoveTime = System.currentTimeMillis() + temporalUnit.getDuration().multipliedBy(delay).toMillis();
|
||||
this.scheduledRemoveTime = System.currentTimeMillis() + TimeUnit.getMillis(delay, temporalUnit);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -242,7 +242,7 @@ public class ItemEntity extends Entity {
|
||||
* @param temporalUnit the unit of the delay
|
||||
*/
|
||||
public void setPickupDelay(long delay, @NotNull TemporalUnit temporalUnit) {
|
||||
this.pickupDelay = temporalUnit.getDuration().multipliedBy(delay).toMillis();
|
||||
this.pickupDelay = TimeUnit.getMillis(delay, temporalUnit);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -670,10 +670,10 @@ public class LivingEntity extends Entity implements EquipmentHandler {
|
||||
* Changes the delay between two fire damage applications.
|
||||
*
|
||||
* @param fireDamagePeriod the delay
|
||||
* @param temporalUnit the time unit
|
||||
* @param temporalUnit the time unit
|
||||
*/
|
||||
public void setFireDamagePeriod(long fireDamagePeriod, @NotNull TemporalUnit temporalUnit) {
|
||||
fireDamagePeriod = temporalUnit.getDuration().multipliedBy(fireDamagePeriod).toMillis();
|
||||
fireDamagePeriod = TimeUnit.getMillis(fireDamagePeriod, temporalUnit);
|
||||
this.fireDamagePeriod = fireDamagePeriod;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class UpdateOption {
|
||||
* @return the converted milliseconds based on the time value and the unit
|
||||
*/
|
||||
public long toMilliseconds() {
|
||||
return temporalUnit.getDuration().multipliedBy(value).toMillis();
|
||||
return TimeUnit.getMillis(value, temporalUnit);
|
||||
}
|
||||
|
||||
public Duration toDuration() {
|
||||
|
Loading…
Reference in New Issue
Block a user