From 2c77f30ba50781e2c39dbc792200ba4f9225b807 Mon Sep 17 00:00:00 2001 From: tastybento Date: Tue, 9 Jul 2024 22:34:24 -0700 Subject: [PATCH] Fix particle for 1.20.6 and later #36 --- pom.xml | 2 +- .../bentobox/twerk/listeners/TreeGrowListener.java | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 4afacf5..acb7022 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@ 1.8 2.0.4 - 1.20.4-R0.1-SNAPSHOT + 1.20.6-R0.1-SNAPSHOT 2.0.0-SNAPSHOT ${build.version}-SNAPSHOT diff --git a/src/main/java/world/bentobox/twerk/listeners/TreeGrowListener.java b/src/main/java/world/bentobox/twerk/listeners/TreeGrowListener.java index 2c340d4..010460f 100644 --- a/src/main/java/world/bentobox/twerk/listeners/TreeGrowListener.java +++ b/src/main/java/world/bentobox/twerk/listeners/TreeGrowListener.java @@ -1,7 +1,6 @@ package world.bentobox.twerk.listeners; import java.util.Arrays; - import java.util.Collections; import java.util.EnumMap; import java.util.HashMap; @@ -31,7 +30,8 @@ import org.bukkit.event.world.StructureGrowEvent; import org.eclipse.jdt.annotation.NonNull; -import world.bentobox.bentobox.BentoBox; +import com.google.common.base.Enums; + import world.bentobox.bentobox.database.objects.Island; import world.bentobox.bentobox.lists.Flags; import world.bentobox.bentobox.util.Util; @@ -271,7 +271,13 @@ private void twerk(Player player) { if (count >= addon.getSettings().getMinimumTwerks()) { player.playSound(player.getLocation(), addon.getSettings().getSoundsTwerkSound(), (float)addon.getSettings().getSoundsTwerkVolume(), (float)addon.getSettings().getSoundsTwerkPitch()); - player.spawnParticle(Particle.SPELL, player.getLocation(), 20, 3D, 0D, 3D); + Particle p = Enums.getIfPresent(Particle.class, "SPELL").orNull(); + if (p == null) { + p = Enums.getIfPresent(Particle.class, "POOF").orNull(); + } + if (p != null) { + player.spawnParticle(p, player.getLocation(), 20, 3D, 0D, 3D); + } } });