mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-15 07:01:36 +08:00
Fix potential for NPE if receivers is null and the world was empty
This commit is contained in:
parent
d4dffd1d71
commit
72c26039eb
@ -1,4 +1,4 @@
|
|||||||
From 6583e28c44eaa9d3a5f6fa225e4dafa82d2aa95e Mon Sep 17 00:00:00 2001
|
From 90a7290801e9df5dc6bd93909df915ffed52e875 Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Tue, 29 Aug 2017 23:58:48 -0400
|
Date: Tue, 29 Aug 2017 23:58:48 -0400
|
||||||
Subject: [PATCH] Expand World.spawnParticle API and add Builder
|
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
|
diff --git a/src/main/java/com/destroystokyo/paper/ParticleBuilder.java b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 00000000..bf4edd07
|
index 00000000..2bccc409
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
|
+++ b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
|
||||||
@@ -0,0 +1,363 @@
|
@@ -0,0 +1,365 @@
|
||||||
+package com.destroystokyo.paper;
|
+package com.destroystokyo.paper;
|
||||||
+
|
+
|
||||||
+import com.google.common.collect.Lists;
|
+import com.google.common.collect.Lists;
|
||||||
@ -96,11 +96,13 @@ index 00000000..bf4edd07
|
|||||||
+ * @return If this particle is going to be sent to someone
|
+ * @return If this particle is going to be sent to someone
|
||||||
+ */
|
+ */
|
||||||
+ public boolean hasReceivers() {
|
+ public boolean hasReceivers() {
|
||||||
+ return (receivers == null && !location.getWorld().getPlayers().isEmpty()) || !receivers.isEmpty();
|
+ return (receivers == null && !location.getWorld().getPlayers().isEmpty()) || (receivers != null && !receivers.isEmpty());
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
+ * Sends this particle to all players in the world
|
+ * Sends this particle to all players in the world. This is rather silly and you should likely not be doing this.
|
||||||
|
+ *
|
||||||
|
+ * Just be a logical person and use receivers by radius or collection.
|
||||||
+ */
|
+ */
|
||||||
+ public ParticleBuilder allPlayers() {
|
+ public ParticleBuilder allPlayers() {
|
||||||
+ this.receivers = null;
|
+ this.receivers = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user