13
0
geforkt von Mirrors/Paper

Fix NPE during server initialization from server list pings

Dieser Commit ist enthalten in:
Shane Freeder 2019-02-06 19:15:46 +00:00
Ursprung d601e3dc2f
Commit 9bca846f08
2 geänderte Dateien mit 5 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -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
new file mode 100644
index 00000000..dd1deafd
index 00000000..b2a8476c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
@@ -0,0 +0,0 @@
@ -185,7 +185,8 @@ index 00000000..dd1deafd
+ * Returns the protocol version that will be sent as the protocol version
+ * 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() {
+ return protocolVersion;

Datei anzeigen

@ -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
new file mode 100644
index 000000000..26e3031d2
index 000000000..a85466bc7
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
@@ -0,0 +0,0 @@
@ -90,7 +90,7 @@ index 000000000..26e3031d2
+ private GameProfile[] originalSample;
+
+ 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
+ }
+