From a014a38e2f3c0d0ea7acab80ca40904191ffa773 Mon Sep 17 00:00:00 2001 From: Allink Date: Tue, 2 Aug 2022 02:47:03 +0100 Subject: [PATCH] Check if array is empty in disabled effect (closes #50) --- server/src/main/java/dev/plex/util/PlexUtils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/dev/plex/util/PlexUtils.java b/server/src/main/java/dev/plex/util/PlexUtils.java index 811b691..58b0aef 100644 --- a/server/src/main/java/dev/plex/util/PlexUtils.java +++ b/server/src/main/java/dev/plex/util/PlexUtils.java @@ -53,9 +53,14 @@ public class PlexUtils implements PlexBase public static void disabledEffectMultiple(Player[] players, Location location) { + if (players.length < 1) { + return; + } + Particle.CLOUD.builder().location(location).receivers(players).extra(0).offset(0.5, 0.5, 0.5).count(5).spawn(); Particle.FLAME.builder().location(location).receivers(players).extra(0).offset(0.5, 0.5, 0.5).count(3).spawn(); - Particle.SOUL_FIRE_FLAME.builder().location(location).receivers(players).offset(0.5, 0.5, 0.5).extra(0).count(2).spawn(); + Particle.SOUL_FIRE_FLAME.builder().location(location).receivers(players).offset(0.5, 0.5, 0.5).extra(0).count(2) + .spawn(); // note that the sound is played to everyone who is close enough to hear it players[0].getWorld().playSound(location, org.bukkit.Sound.BLOCK_FIRE_EXTINGUISH, 0.5f, 0.5f); }