Skip to content

Commit 0ea98d4

Browse files
authored
EffPotion - fix potion duration issue (#5992)
1 parent 9c82fed commit 0ea98d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/ch/njol/skript/effects/EffPotion.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelaye
101101
potions = (Expression<PotionEffectType>) exprs[0];
102102
tier = (Expression<Number>) exprs[1];
103103
entities = (Expression<LivingEntity>) exprs[2];
104-
if (infinite)
104+
if (!infinite)
105105
duration = (Expression<Timespan>) exprs[3];
106106
}
107107
return true;
@@ -125,7 +125,7 @@ protected void execute(Event event) {
125125
Timespan timespan = this.duration.getSingle(event);
126126
if (timespan == null)
127127
return;
128-
duration = (int) Math.max(timespan.getTicks_i(), Integer.MAX_VALUE);
128+
duration = (int) Math.min(timespan.getTicks_i(), Integer.MAX_VALUE);
129129
}
130130
for (LivingEntity entity : entities.getArray(event)) {
131131
for (PotionEffectType potionEffectType : potionEffectTypes) {

0 commit comments

Comments
 (0)