From 54b5ab6d79f0c01a38b4818ceaa5d1832c1a6692 Mon Sep 17 00:00:00 2001 From: Mohamad82Bz Date: Tue, 25 May 2021 20:24:06 +0430 Subject: [PATCH] Fixed PotionEffect was adding asynchronously --- .../com/volmit/iris/object/IrisEffect.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/volmit/iris/object/IrisEffect.java b/src/main/java/com/volmit/iris/object/IrisEffect.java index e1b625912..3f18839c5 100644 --- a/src/main/java/com/volmit/iris/object/IrisEffect.java +++ b/src/main/java/com/volmit/iris/object/IrisEffect.java @@ -8,6 +8,7 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.Sound; @@ -231,7 +232,13 @@ public class IrisEffect J.sr(() -> { p.playSound(part, getSound(), (float) volume, (float) RNG.r.d(minPitch, maxPitch)); + Iris.instance.getLogger().info("§bPlayer Location: " + + p.getLocation().getBlockX() + " " + p.getLocation().getBlockY() + " " + p.getLocation().getBlockZ() + + " Sound Location: " + part.getBlockX() + " " + part.getBlockY() + " " + part.getBlockZ() + + " Sound's Name: " + getSound().name()); }); + } else { + Bukkit.getConsoleSender().sendMessage("Sound is null :("); } if(particleEffect != null) @@ -275,10 +282,18 @@ public class IrisEffect return; } - p.removePotionEffect(getRealType()); + J.sr(() -> { + p.removePotionEffect(getRealType()); + }); } - p.addPotionEffect(new PotionEffect(getRealType(), RNG.r.i(Math.min(potionTicksMax, potionTicksMin), Math.max(potionTicksMax, potionTicksMin)), getPotionStrength(), true, false, false)); + J.sr(() -> { + p.addPotionEffect(new PotionEffect(getRealType(), + RNG.r.i(Math.min(potionTicksMax, potionTicksMin), + Math.max(potionTicksMax, potionTicksMin)), + getPotionStrength(), + true, false, false)); + }); } } }