Paper/Spigot-API-Patches/0018-Fix-ServerListPingEvent-flagging-as-Async.patch
Shane Freeder 0976d52bbd Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Please note that this build includes changes to meet upstreams
requirements for nullability annotations. While we aim for a level of
accuracy, these might not be 100% correct, if there are any issues,
please speak to us on discord, or open an issue on the tracker to
discuss.

Bukkit Changes:
9a6a1de3 Remove nullability annotations from enum constructors
3f0591ea SPIGOT-2540: Add nullability annotations to entire Bukkit API

CraftBukkit Changes:
8d8475fc SPIGOT-4666: Force parameter in HumanEntity#sleep
8b1588e2 Fix ExplosionPrimeEvent#setFire not working with EnderCrystals
39a287b7 Don't ignore newlines in PlayerListHeader/Footer

Spigot Changes:
cf694d87 Add nullability annotations
2019-03-20 00:31:18 +00:00

55 lines
2.2 KiB
Diff

From 1b07518a82ecb065e8b048fbf5dee4498d15c1be Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 29 Feb 2016 20:26:39 -0600
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 d873763d..b68d7b2f 100644
--- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
@@ -23,6 +23,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
private int maxPlayers;
public ServerListPingEvent(@NotNull final InetAddress address, @NotNull 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;
@@ -40,6 +41,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* @param maxPlayers the max number of players
*/
protected ServerListPingEvent(@NotNull final InetAddress address, @NotNull 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.21.0