From a7e548c1b29632342669dfdca110422cd7c1ebff Mon Sep 17 00:00:00 2001 From: tastybento Date: Thu, 4 Apr 2024 16:25:57 -0700 Subject: [PATCH 1/3] 33 prevent extra dirt (#34) * Version 1.5.1 * Prevents extra dirt being created when tree is grown. Fixes #33 --- pom.xml | 2 +- .../world/bentobox/twerk/listeners/TreeGrowListener.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 97e3814..4afacf5 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ ${build.version}-SNAPSHOT - 1.5.0 + 1.5.1 -LOCAL bentobox-world https://sonarcloud.io diff --git a/src/main/java/world/bentobox/twerk/listeners/TreeGrowListener.java b/src/main/java/world/bentobox/twerk/listeners/TreeGrowListener.java index 96025ca..2c340d4 100644 --- a/src/main/java/world/bentobox/twerk/listeners/TreeGrowListener.java +++ b/src/main/java/world/bentobox/twerk/listeners/TreeGrowListener.java @@ -31,6 +31,7 @@ import org.bukkit.event.world.StructureGrowEvent; import org.eclipse.jdt.annotation.NonNull; +import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.database.objects.Island; import world.bentobox.bentobox.lists.Flags; import world.bentobox.bentobox.util.Util; @@ -134,8 +135,9 @@ protected void growTree(Block b) { b.setType(Material.AIR); if (b.getWorld().generateTree(b.getLocation(), RAND, type, - bs -> Flags.TREES_GROWING_OUTSIDE_RANGE.isSetForWorld(bs.getWorld()) - || addon.getIslands().getProtectedIslandAt(bs.getLocation()).isPresent())) { + bs -> bs.getType() != Material.DIRT + && (Flags.TREES_GROWING_OUTSIDE_RANGE.isSetForWorld(bs.getWorld()) + || addon.getIslands().getProtectedIslandAt(bs.getLocation()).isPresent()))) { if (addon.getSettings().isEffectsEnabled()) { showSparkles(b); } From 2c77f30ba50781e2c39dbc792200ba4f9225b807 Mon Sep 17 00:00:00 2001 From: tastybento Date: Tue, 9 Jul 2024 22:34:24 -0700 Subject: [PATCH 2/3] 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); + } } }); From dd81a08e1a7d39592b2abe892da1618cea1472ec Mon Sep 17 00:00:00 2001 From: tastybento Date: Tue, 9 Jul 2024 22:34:59 -0700 Subject: [PATCH 3/3] Version 1.5.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index acb7022..6d30890 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ ${build.version}-SNAPSHOT - 1.5.1 + 1.5.2 -LOCAL bentobox-world https://sonarcloud.io