From 6c99894e776c8c247af9a15d5120b3bf3c543e9d Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Fri, 12 Nov 2021 13:26:46 +0300 Subject: [PATCH] Added "chance" argument to SpawnHelper event --- .../ecoweapons/effects/effects/EffectSpawnHelper.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoweapons/effects/effects/EffectSpawnHelper.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoweapons/effects/effects/EffectSpawnHelper.java index 4195808..71ba309 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoweapons/effects/effects/EffectSpawnHelper.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoweapons/effects/effects/EffectSpawnHelper.java @@ -72,6 +72,13 @@ public class EffectSpawnHelper extends Effect implements Listener { } } + Double chance = args.getDoubleOrNull("chance"); + if (chance != null) { + if (NumberUtils.randInt(0, 100) > chance) { + return; + } + } + World world = location.getWorld(); assert world != null;