From 690b4cb8b1f30f327a07a3a1e20194c6e5290af0 Mon Sep 17 00:00:00 2001 From: Shane Bee Date: Mon, 11 Sep 2023 01:19:47 -0700 Subject: [PATCH] EffPotion - fix potion duration issue (#5992) --- src/main/java/ch/njol/skript/effects/EffPotion.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/ch/njol/skript/effects/EffPotion.java b/src/main/java/ch/njol/skript/effects/EffPotion.java index 64b07bb0be4..46abcb3ecf4 100644 --- a/src/main/java/ch/njol/skript/effects/EffPotion.java +++ b/src/main/java/ch/njol/skript/effects/EffPotion.java @@ -101,7 +101,7 @@ public boolean init(Expression[] exprs, int matchedPattern, Kleenean isDelaye potions = (Expression) exprs[0]; tier = (Expression) exprs[1]; entities = (Expression) exprs[2]; - if (infinite) + if (!infinite) duration = (Expression) exprs[3]; } return true; @@ -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) {