Add alternative to LivingEntity#setFireDamagePeriod that takes Duration

This commit is contained in:
Németh Noel 2021-07-03 14:52:51 +02:00
parent efb450ce50
commit 663e53c875

View File

@ -670,7 +670,7 @@ public class LivingEntity extends Entity implements EquipmentHandler {
* Gets the time in ms between two fire damage applications.
*
* @return the time in ms
* @see #setFireDamagePeriod(long, TemporalUnit)
* @see #setFireDamagePeriod(Duration)
*/
public long getFireDamagePeriod() {
return fireDamagePeriod;
@ -683,8 +683,16 @@ public class LivingEntity extends Entity implements EquipmentHandler {
* @param temporalUnit the time unit
*/
public void setFireDamagePeriod(long fireDamagePeriod, @NotNull TemporalUnit temporalUnit) {
fireDamagePeriod = TimeUnit.getMillis(fireDamagePeriod, temporalUnit);
this.fireDamagePeriod = fireDamagePeriod;
setFireDamagePeriod(Duration.of(fireDamagePeriod, temporalUnit));
}
/**
* Changes the delay between two fire damage applications.
*
* @param fireDamagePeriod the delay
*/
public void setFireDamagePeriod(Duration fireDamagePeriod) {
this.fireDamagePeriod = fireDamagePeriod.toMillis();
}
/**