Skip to content

Commit

Permalink
EffPotion - fix potion duration issue (SkriptLang#5992)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneBeee authored and AyhamAl-Ali committed Sep 11, 2023
1 parent 3f08853 commit 690b4cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/ch/njol/skript/effects/EffPotion.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelaye
potions = (Expression<PotionEffectType>) exprs[0];
tier = (Expression<Number>) exprs[1];
entities = (Expression<LivingEntity>) exprs[2];
if (infinite)
if (!infinite)
duration = (Expression<Timespan>) exprs[3];
}
return true;
Expand All @@ -125,7 +125,7 @@ protected void execute(Event event) {
Timespan timespan = this.duration.getSingle(event);
if (timespan == null)
return;
duration = (int) Math.max(timespan.getTicks_i(), Integer.MAX_VALUE);
duration = (int) Math.min(timespan.getTicks_i(), Integer.MAX_VALUE);
}
for (LivingEntity entity : entities.getArray(event)) {
for (PotionEffectType potionEffectType : potionEffectTypes) {
Expand Down

0 comments on commit 690b4cb

Please sign in to comment.