Ensure VillagerTrades doesn't load async - fixes #3495

In rare cases, this class could potentially be loaded from
the chunk threads causing it to initialize async and cause errors.

This would then break the server and chunk saving.

So ensure its loaded at start of server to avoid this.
This commit is contained in:
Aikar 2020-06-03 00:00:17 -04:00
parent e470f1effe
commit 3d2bc848c1
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
2 changed files with 11 additions and 3 deletions

View File

@ -2949,7 +2949,7 @@ index 20f54baacebe98435539d4cbef41f182040db2e9..9f8c0e10e42d233a8b74ee5a71fb8fb6
+ }
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7920d24ab089fb8360ef74946cf7dc35cb7625eb..7956b082351e5923073a97d88009e9e288c13c11 100644
index 7920d24ab089fb8360ef74946cf7dc35cb7625eb..9450e27e5ce9295d87b95be2797fc27984ca2b0b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -780,6 +780,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -2960,6 +2960,14 @@ index 7920d24ab089fb8360ef74946cf7dc35cb7625eb..7956b082351e5923073a97d88009e9e2
}
public String getServerIp() {
@@ -1401,6 +1402,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
dedicatedserver.setEraseCache(true);
}
+ Class.forName("net.minecraft.server.VillagerTrades");// Paper - load this sync so it won't fail later async
dedicatedserver.serverThread.setPriority(Thread.NORM_PRIORITY+2); // Paper - boost priority
dedicatedserver.serverThread.start();
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java
index e9c405fb5376c5733b9b0191cd5309173f4021e8..33cfeabdee03195a294f303f28044a313cb1c4ed 100644
--- a/src/main/java/net/minecraft/server/NextTickListEntry.java

View File

@ -87,7 +87,7 @@ index f8f225e18fa38cad917f52a379233e0a7a869b07..3ee7e5671dd2519cec72b81211f1f391
version = getInt("config-version", 20);
set("config-version", 20);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fce55573507214ab6a10381721dd2bf7acb24d5b..711a00c9e3781d3b32f2b514302f530df15a4257 100644
index 2d54c9a27fc5ca35c54a42b59f5321277d2d822b..c07339c87f8efff9c26aadc778cc3b16e170673f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -106,6 +106,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -115,7 +115,7 @@ index fce55573507214ab6a10381721dd2bf7acb24d5b..711a00c9e3781d3b32f2b514302f530d
this.circularTimer.a(i1 - i);
this.methodProfiler.exit();
org.spigotmc.WatchdogThread.tick(); // Spigot
@@ -2276,4 +2287,30 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -2277,4 +2288,30 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
return SERVER; // Paper
}
// CraftBukkit end