mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-27 10:23:52 -07:00
Fix NPE during server initialization from server list pings
This commit is contained in:
@@ -8,7 +8,7 @@ and allows full control of the response sent to the client.
|
|||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
|
diff --git a/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 00000000..dd1deafd
|
index 00000000..b2a8476c
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
|
+++ b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
@@ -185,7 +185,8 @@ index 00000000..dd1deafd
|
|||||||
+ * Returns the protocol version that will be sent as the protocol version
|
+ * Returns the protocol version that will be sent as the protocol version
|
||||||
+ * of the server to the client.
|
+ * of the server to the client.
|
||||||
+ *
|
+ *
|
||||||
+ * @return The protocol version of the server
|
+ * @return The protocol version of the server, or {@code -1} if the server
|
||||||
|
+ * has not finished initialization yet
|
||||||
+ */
|
+ */
|
||||||
+ public int getProtocolVersion() {
|
+ public int getProtocolVersion() {
|
||||||
+ return protocolVersion;
|
+ return protocolVersion;
|
||||||
|
@@ -60,7 +60,7 @@ index 000000000..a2a409e63
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
|
diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 000000000..26e3031d2
|
index 000000000..a85466bc7
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
|
+++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
@@ -90,7 +90,7 @@ index 000000000..26e3031d2
|
|||||||
+ private GameProfile[] originalSample;
|
+ private GameProfile[] originalSample;
|
||||||
+
|
+
|
||||||
+ private StandardPaperServerListPingEventImpl(MinecraftServer server, NetworkManager networkManager, ServerPing ping) {
|
+ private StandardPaperServerListPingEventImpl(MinecraftServer server, NetworkManager networkManager, ServerPing ping) {
|
||||||
+ super(server, new PaperStatusClient(networkManager), ping.getServerData().getProtocolVersion(), server.server.getServerIcon());
|
+ super(server, new PaperStatusClient(networkManager), ping.getServerData() != null ? ping.getServerData().getProtocolVersion() : -1, server.server.getServerIcon());
|
||||||
+ this.originalSample = ping.getPlayers() == null ? null : ping.getPlayers().getSample(); // GH-1473 - pre-tick race condition NPE
|
+ this.originalSample = ping.getPlayers() == null ? null : ping.getPlayers().getSample(); // GH-1473 - pre-tick race condition NPE
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
Reference in New Issue
Block a user