diff --git a/Spigot-API-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch b/Spigot-API-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch index 632d0ffa50..34f3161474 100644 --- a/Spigot-API-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/Spigot-API-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch @@ -10,7 +10,7 @@ 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 +0,0 @@ @@ -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 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) 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 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; + } +