mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 20:30:28 +01:00
5c7081fecc
* Updated Upstream (Bukkit/CraftBukkit) 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 Bukkit Changes: 45690fe9 SPIGOT-5047: Correct slot types for 1.14 inventories CraftBukkit Changes:4090d01f
SPIGOT-5047: Correct slot types for 1.14 inventoriese8c08362
SPIGOT-5046: World#getLoadedChunks returning inaccessible cached chunks.d445af3b
SPIGOT-5067: Add item meta for 1.14 spawn eggs * Bring Chunk load checks in-line with spigot As of the last upstream merge spigot now checks ticket level status when returning loaded chunks for a world from api. Now our checks will respect that decision. * Fix spawn ticket levels Vanilla would keep the inner chunks of spawn available for ticking, however my changes made all chunks non-ticking. Resolve by changing ticket levels for spawn chunks inside the border to respect this behavior. * Make World#getChunkIfLoadedImmediately return only entity ticking chunks Mojang appears to be using chunks with level > 33 (non-ticking chunks) as cached chunks and not actually loaded chunks. * Bring all loaded checks in line with spigot Loaded chunks must be at least border chunks, or level <= 33
73 lines
3.0 KiB
Diff
73 lines
3.0 KiB
Diff
From 2032fe6a3574b741622b9ff0f10d215fef097a43 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Sun, 31 Mar 2019 22:02:24 -0700
|
|
Subject: [PATCH] Allow login events to fire only after the server plugins are
|
|
enabled
|
|
|
|
Event threads will simply block until they're ready to accept.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
|
|
index 9e4bc24058..028c23dbe6 100644
|
|
--- a/src/main/java/net/minecraft/server/LoginListener.java
|
|
+++ b/src/main/java/net/minecraft/server/LoginListener.java
|
|
@@ -285,6 +285,36 @@ public class LoginListener implements PacketLoginInListener {
|
|
}
|
|
}
|
|
|
|
+ // Paper start - Delay async prelogin until plugins are ready
|
|
+ private static volatile Object blockingLogins = new Object();
|
|
+
|
|
+ public static void checkStartupAndBlock() {
|
|
+ final Object lock = LoginListener.blockingLogins;
|
|
+ if (lock != null) {
|
|
+ synchronized (lock) {
|
|
+ for (;;) {
|
|
+ if (LoginListener.blockingLogins == null) {
|
|
+ return;
|
|
+ }
|
|
+ try {
|
|
+ lock.wait();
|
|
+ } catch (final InterruptedException ignore) {// handled by the if statement above
|
|
+ Thread.currentThread().interrupt();
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public static void allowLogins() {
|
|
+ final Object lock = LoginListener.blockingLogins;
|
|
+ synchronized (lock) {
|
|
+ LoginListener.blockingLogins = null;
|
|
+ lock.notifyAll();
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
// Spigot start
|
|
public class LoginHandler {
|
|
|
|
@@ -295,6 +325,7 @@ public class LoginListener implements PacketLoginInListener {
|
|
return;
|
|
}
|
|
// Paper end
|
|
+ LoginListener.checkStartupAndBlock(); // Paper - Delay async login events until plugins are ready
|
|
String playerName = i.getName();
|
|
java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress();
|
|
java.util.UUID uniqueId = i.getId();
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index cbb4280631..ba68d7f833 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -462,6 +462,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
// Paper end
|
|
|
|
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
|
+ LoginListener.allowLogins(); // Paper - Allow logins once postworld
|
|
this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
|
|
// CraftBukkit end
|
|
|
|
--
|
|
2.21.0
|
|
|