From b43d08f4aa310982b8c83d725fba7323846fb4c0 Mon Sep 17 00:00:00 2001 From: Xaver106 <46501008+Xaver106@users.noreply.github.com> Date: Mon, 10 Jan 2022 13:18:19 +0100 Subject: [PATCH] feat: Display explosion particles even after the event got canceled (with setting to control behavior) (#3436) * feat: display explosion particles even after event cancel And add settings option to change behavior * refactor * refactor: Change settings comment to clearer connect to it's purpose. --- .../com/plotsquared/bukkit/listener/EntityEventListener.java | 5 +++++ .../java/com/plotsquared/core/configuration/Settings.java | 2 ++ 2 files changed, 7 insertions(+) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java index e7d6d4c1c..8c10850e7 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java @@ -48,6 +48,7 @@ import com.plotsquared.core.util.Permissions; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BlockType; import org.bukkit.Material; +import org.bukkit.Particle; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.entity.Ageable; @@ -323,6 +324,10 @@ public class EntityEventListener implements Listener { } } event.setCancelled(true); + //Spawn Explosion Particles when enabled in settings + if (Settings.General.ALWAYS_SHOW_EXPLOSIONS) { + event.getLocation().getWorld().spawnParticle(Particle.EXPLOSION_HUGE, event.getLocation(), 0); + } } @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java index 367e40091..e8a52634a 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -279,6 +279,8 @@ public class Settings extends Config { public static boolean SCIENTIFIC = false; @Comment("Replace wall when merging") public static boolean MERGE_REPLACE_WALL = true; + @Comment("Always show explosion Particles, even if explosion flag is set to false") + public static boolean ALWAYS_SHOW_EXPLOSIONS = false; @Comment({"Blocks that may not be used in plot components", "Checkout the wiki article regarding plot components before modifying: https://github.com/IntellectualSites/PlotSquared-Documentation/wiki/Plot-Components"}) public static List