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.
This commit is contained in:
Xaver106 2022-01-10 13:18:19 +01:00 committed by GitHub
parent 2c55c6a92e
commit b43d08f4aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -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)

View File

@ -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<String>