Fix class preloading

This commit is contained in:
Mariell Hoversholm 2021-03-16 17:47:15 +01:00
parent 1c03cf8987
commit e62aa5e3e4
5 changed files with 32 additions and 15 deletions

View File

@ -2328,14 +2328,22 @@ index fbd33aef21b4539d249c367609a36491530fb7ca..5a410550cfb48505c9de9979465ed152
+ }
}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 191a74bd9b894f9d64d0a55747cb17e07ceef597..949e374d1e3bdbe31b160ad5ab6c0153f16fb07e 100644
index 191a74bd9b894f9d64d0a55747cb17e07ceef597..c0f5fdb832115c5a86005e4c3242d9fd7e52f82c 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -210,6 +210,7 @@ public class Main {
@@ -42,6 +42,7 @@ import net.minecraft.server.players.UserCache;
import net.minecraft.util.MathHelper;
import net.minecraft.util.datafix.DataConverterRegistry;
import net.minecraft.util.worldupdate.WorldUpgrader;
+import net.minecraft.world.entity.npc.VillagerTrades;
import net.minecraft.world.level.DataPackConfiguration;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.World;
@@ -210,6 +211,7 @@ public class Main {
convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object);
*/
+ Class.forName("net.minecraft.server.VillagerTrades");// Paper - load this sync so it won't fail later async
+ Class.forName(VillagerTrades.class.getSimpleName());// Paper - load this sync so it won't fail later async
final DedicatedServer dedicatedserver = (DedicatedServer) MinecraftServer.a((thread) -> {
DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataConverterRegistry.a(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new);

View File

@ -358,10 +358,19 @@ index 4828d356ca01cba5964c6397584d56643dbc0dae..55890ff463eb122934e8ba1fc550cf0c
// Paper start
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 67331fa5463dd31e4aea3aebf6204ec5cb43d99e..9cd50aa48c5cd67631c8c99543ed8e162603b423 100644
index 67331fa5463dd31e4aea3aebf6204ec5cb43d99e..2a36de929e6d433b0f67f0a901c03c624cd41e17 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -150,6 +150,37 @@ public class Main {
@@ -12,6 +12,8 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
+import net.minecraft.util.ExceptionSuppressor;
+import net.minecraft.world.level.lighting.LightEngineLayerEventListener;
import net.minecrell.terminalconsole.TerminalConsoleAppender; // Paper
public class Main {
@@ -150,6 +152,37 @@ public class Main {
OptionSet options = null;
@ -399,7 +408,7 @@ index 67331fa5463dd31e4aea3aebf6204ec5cb43d99e..9cd50aa48c5cd67631c8c99543ed8e16
try {
options = parser.parse(args);
} catch (joptsimple.OptionException ex) {
@@ -245,8 +276,64 @@ public class Main {
@@ -245,8 +278,64 @@ public class Main {
} catch (Throwable t) {
t.printStackTrace();
}
@ -442,9 +451,9 @@ index 67331fa5463dd31e4aea3aebf6204ec5cb43d99e..9cd50aa48c5cd67631c8c99543ed8e16
+ tryPreloadClass("com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent");
+ tryPreloadClass("com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent");
+ // Minecraft, seen during saving
+ tryPreloadClass("net.minecraft.world.level.lighting.LightEngineLayerEventListener$Void");
+ tryPreloadClass("net.minecraft.world.level.lighting.LightEngineLayerEventListener");
+ tryPreloadClass("net.minecraft.util.ExceptionSuppressor");
+ tryPreloadClass(LightEngineLayerEventListener.Void.class.getSimpleName());
+ tryPreloadClass(LightEngineLayerEventListener.class.getSimpleName());
+ tryPreloadClass(ExceptionSuppressor.class.getSimpleName());
+ // Paper end
+ }
+ }

View File

@ -17,10 +17,10 @@ keeping long lived large direct buffers in cache.
Set system properly at server startup if not set already to help protect from this.
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 9cd50aa48c5cd67631c8c99543ed8e162603b423..8a1ff1000f82a590b293e8892a34484df068093c 100644
index 2a36de929e6d433b0f67f0a901c03c624cd41e17..af1b93beee1cf4ea1be356eb47ef9a3c8d0f2837 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -20,6 +20,7 @@ public class Main {
@@ -22,6 +22,7 @@ public class Main {
public static void main(String[] args) {
// Todo: Installation script

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5824 Bukkit world-container is not used
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 949e374d1e3bdbe31b160ad5ab6c0153f16fb07e..9e453545c37750152debbf7a663b2ec55c54387f 100644
index c0f5fdb832115c5a86005e4c3242d9fd7e52f82c..6a15a5f7d3e82f61c0f30bb6a339215376d4867d 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -131,11 +131,20 @@ public class Main {
@@ -132,11 +132,20 @@ public class Main {
return;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5885 Unable to disable advancements
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 9e453545c37750152debbf7a663b2ec55c54387f..4d8f976a2f9ba2b54c39978b83f7b3de55fc1979 100644
index 6a15a5f7d3e82f61c0f30bb6a339215376d4867d..f34d5b214c4726f3b3b96610c1dca3d0d17a09ab 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -131,6 +131,7 @@ public class Main {
@@ -132,6 +132,7 @@ public class Main {
return;
}