[SPIGOT-3442] Bug with PotionEffect Creation Created: 22/Jul/17 Updated: 22/Jul/17 Resolved: 22/Jul/17 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Ryan Samarakoon | Assignee: | Unassigned |
Resolution: | Cannot Reproduce | Votes: | 0 |
Labels: | 1.12-pre6, bug, spigot, spigot-api | ||
Environment: |
Spigot ver: 1.12-pre6-SNAPSHOT
|
Description |
With the following code... entity.addPotionEffect(PotionEffectType.SPEED.createEffect(100,0)); the effect should last for 5 seconds, but instead, it lasts for hardly one. When this is called in an EntityDamageByEntityEvent (only place I've tested) the potion effect duration is bugged. During testing, I have found values of around 800 give 9 seconds which makes no sense as 20 ticks are in a second. Now, I have worked around this by creating a PotionEffect with new PotionEffect() instead, outside the event. This works fine if I have this stored elsewhere and use it when adding a potion effect. Make sure to fix this or give documentation as people such as I can waste several amounts of time trying to debug this. Thank you |
Comments |
Comment by md_5 [ 22/Jul/17 ] |
@EventHandler
public void event(EntityDamageByEntityEvent event)
{
((LivingEntity)event.getEntity()).addPotionEffect( PotionEffectType.SPEED.createEffect( 100, 0 ) );
}
Also you're using a pre release |
Comment by Black Hole [ 22/Jul/17 ] |
Also duplicates |
Comment by Black Hole [ 22/Jul/17 ] |
The documentation for PotionEffectType.createEffect() could be improved. It states: "Creates a PotionEffect from this PotionEffectType, applying duration modifiers and checks." So if you want an exact duration this method is not what you want. Duration modifiers is a vanilla concept. That's why potions have a variety of duration for the same tier: |