From fd4a65c5661a77d7467eae943a795216e6c11211 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 6 Jun 2018 21:27:50 -0400
Subject: [PATCH] Expand ParticleBuilder more with hasReceivers, fix empty
 receivers list

---
 ...ld.spawnParticle-API-and-add-Builder.patch | 30 ++++++++++++++-----
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/Spigot-API-Patches/0102-Expand-World.spawnParticle-API-and-add-Builder.patch b/Spigot-API-Patches/0102-Expand-World.spawnParticle-API-and-add-Builder.patch
index e9ce6ea2f0..c2fc59746d 100644
--- a/Spigot-API-Patches/0102-Expand-World.spawnParticle-API-and-add-Builder.patch
+++ b/Spigot-API-Patches/0102-Expand-World.spawnParticle-API-and-add-Builder.patch
@@ -1,4 +1,4 @@
-From 50ea02411e05bfeafc16c29acb4c95087b9082a1 Mon Sep 17 00:00:00 2001
+From 4d48c8f3cf54c6845922fb62b32adcab7d1558dd Mon Sep 17 00:00:00 2001
 From: Aikar <aikar@aikar.co>
 Date: Tue, 29 Aug 2017 23:58:48 -0400
 Subject: [PATCH] Expand World.spawnParticle API and add Builder
@@ -10,10 +10,10 @@ This adds a new Builder API which is much friendlier to use.
 
 diff --git a/src/main/java/com/destroystokyo/paper/ParticleBuilder.java b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
 new file mode 100644
-index 00000000..a3d8caae
+index 00000000..ef07ab3c
 --- /dev/null
 +++ b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
-@@ -0,0 +1,349 @@
+@@ -0,0 +1,363 @@
 +package com.destroystokyo.paper;
 +
 +import com.google.common.collect.Lists;
@@ -87,6 +87,19 @@ index 00000000..a3d8caae
 +    }
 +
 +    /**
++     * Example use:
++     *
++     * builder.receivers(16);
++     * if (builder.hasReceivers()) {
++     *     sendParticleAsync(builder);
++     * }
++     * @return If this particle is going to be sent to someone
++     */
++    public boolean hasReceivers() {
++        return receivers == null || !receivers.isEmpty();
++    }
++
++    /**
 +     * Sends this particle to all players in the world
 +     */
 +    public ParticleBuilder allPlayers() {
@@ -95,16 +108,17 @@ index 00000000..a3d8caae
 +    }
 +
 +    /**
-+     * @param receivers List of players to receive this particle, or null
++     * @param receivers List of players to receive this particle, or null for all players in the world
 +     */
 +    public ParticleBuilder receivers(@Nullable List<Player> receivers) {
 +        // Had to keep this as we first made API List<> and not Collection, but removing this may break plugins compiled on older jars
 +        // TODO: deprecate?
-+        return receivers((Collection<Player>) receivers);
++        this.receivers = receivers != null ? Lists.newArrayList(receivers) : null;
++        return this;
 +    }
 +
 +    /**
-+     * @param receivers List of players to receive this particle, or null
++     * @param receivers List of players to receive this particle, or null for all players in the world
 +     */
 +    public ParticleBuilder receivers(@Nullable Collection<Player> receivers) {
 +        this.receivers = receivers != null ? Lists.newArrayList(receivers) : null;
@@ -112,10 +126,10 @@ index 00000000..a3d8caae
 +    }
 +
 +    /**
-+     * @param receivers List of players to be receive this particle, or null
++     * @param receivers List of players to be receive this particle, or null for all players in the world
 +     */
 +    public ParticleBuilder receivers(Player... receivers) {
-+        this.receivers = receivers != null && receivers.length > 0 ? Lists.newArrayList(receivers) : null;
++        this.receivers = receivers != null ? Lists.newArrayList(receivers) : null;
 +        return this;
 +    }
 +