aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-API-Patches/0022-Fix-ServerListPingEvent-flagging-as-Async.patch
blob: 76ec3b373069d283d4fd17d5567f68f0ac4ce803 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From 8d551e5b699b7a24a24b6edbc7f014ce1ef9875d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 24 Feb 2016 00:57:22 -0500
Subject: [PATCH] Fix ServerListPingEvent flagging as Async

This event can sometimes fire Async, set the proper boolean

diff --git a/src/main/java/org/bukkit/event/server/ServerEvent.java b/src/main/java/org/bukkit/event/server/ServerEvent.java
index eb00d6af..70416c81 100644
--- a/src/main/java/org/bukkit/event/server/ServerEvent.java
+++ b/src/main/java/org/bukkit/event/server/ServerEvent.java
@@ -1,9 +1,19 @@
 package org.bukkit.event.server;
 
+import org.bukkit.Bukkit;
 import org.bukkit.event.Event;
 
 /**
  * Miscellaneous server events
  */
 public abstract class ServerEvent extends Event {
+    // Paper start
+    public ServerEvent(boolean isAsync) {
+        super(isAsync);
+    }
+
+    public ServerEvent() {
+        super(!Bukkit.isPrimaryThread());
+    }
+    // Paper end
 }
diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
index 343f238f..3c38d857 100644
--- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
@@ -21,6 +21,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
     private int maxPlayers;
 
     public ServerListPingEvent(final InetAddress address, final String motd, final int numPlayers, final int maxPlayers) {
+        super(); // Paper - Is this event being fired async?
         Validate.isTrue(numPlayers >= 0, "Cannot have negative number of players online", numPlayers);
         this.address = address;
         this.motd = motd;
@@ -38,6 +39,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
      * @param maxPlayers the max number of players
      */
     protected ServerListPingEvent(final InetAddress address, final String motd, final int maxPlayers) {
+        super(); // Paper - Is this event being fired async?
         this.numPlayers = MAGIC_PLAYER_COUNT;
         this.address = address;
         this.motd = motd;
-- 
2.34.0