mirror of
https://github.com/TotalFreedomMC/TF-WorldGuardExtraFlagsPlugin.git
synced 2024-05-21 12:01:23 +00:00
Fixed potion effect restoring wrong time
This commit is contained in:
parent
75be12e7db
commit
f2e1dc8f61
|
@ -16,13 +16,13 @@ public class PotionEffectDetails
|
|||
@Getter private final boolean particles;
|
||||
@Getter private final Color color;
|
||||
|
||||
public double getTimeLeft()
|
||||
public long getTimeLeft()
|
||||
{
|
||||
return (this.endTime - System.nanoTime()) / TimeUnit.MICROSECONDS.toNanos(50L);
|
||||
return (this.endTime - System.nanoTime());
|
||||
}
|
||||
|
||||
public int getTimeLeftInTicks()
|
||||
{
|
||||
return (int)(this.getTimeLeft() / 0.05);
|
||||
return (int)(this.getTimeLeft() / TimeUnit.MILLISECONDS.toNanos(50L));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class GiveEffectsFlagHandler extends Handler
|
|||
|
||||
if (this.givenEffects.add(effect.getType()) && effect_ != null)
|
||||
{
|
||||
this.removedEffects.put(effect_.getType(), new PotionEffectDetails(System.nanoTime() + (long)(effect.getDuration() / 20D * TimeUnit.SECONDS.toNanos(1L)), effect_.getAmplifier(), effect_.isAmbient(), effect_.hasParticles(), SupportedFeatures.isMobEffectColorsSupported() ? effect_.getColor() : null));
|
||||
this.removedEffects.put(effect_.getType(), new PotionEffectDetails(System.nanoTime() + (long)(effect_.getDuration() / 20D * TimeUnit.SECONDS.toNanos(1L)), effect_.getAmplifier(), effect_.isAmbient(), effect_.hasParticles(), SupportedFeatures.isMobEffectColorsSupported() ? effect_.getColor() : null));
|
||||
|
||||
player.removePotionEffect(effect_.getType());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue