mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-08 01:17:47 +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;
|
this.scheduledRemoveTime = 0;
|
||||||
return;
|
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
|
* @param temporalUnit the unit of the delay
|
||||||
*/
|
*/
|
||||||
public void setPickupDelay(long delay, @NotNull TemporalUnit temporalUnit) {
|
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.
|
* Changes the delay between two fire damage applications.
|
||||||
*
|
*
|
||||||
* @param fireDamagePeriod the delay
|
* @param fireDamagePeriod the delay
|
||||||
* @param temporalUnit the time unit
|
* @param temporalUnit the time unit
|
||||||
*/
|
*/
|
||||||
public void setFireDamagePeriod(long fireDamagePeriod, @NotNull TemporalUnit temporalUnit) {
|
public void setFireDamagePeriod(long fireDamagePeriod, @NotNull TemporalUnit temporalUnit) {
|
||||||
fireDamagePeriod = temporalUnit.getDuration().multipliedBy(fireDamagePeriod).toMillis();
|
fireDamagePeriod = TimeUnit.getMillis(fireDamagePeriod, temporalUnit);
|
||||||
this.fireDamagePeriod = fireDamagePeriod;
|
this.fireDamagePeriod = fireDamagePeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class UpdateOption {
|
|||||||
* @return the converted milliseconds based on the time value and the unit
|
* @return the converted milliseconds based on the time value and the unit
|
||||||
*/
|
*/
|
||||||
public long toMilliseconds() {
|
public long toMilliseconds() {
|
||||||
return temporalUnit.getDuration().multipliedBy(value).toMillis();
|
return TimeUnit.getMillis(value, temporalUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Duration toDuration() {
|
public Duration toDuration() {
|
||||||
|
Loading…
Reference in New Issue
Block a user