Archiviert
13
0
Dieses Repository wurde am 2021-12-14 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
SteamSpigot/SteamWar-Patches/Load_Plugins_async.patch

41 Zeilen
2.1 KiB
Diff

Index: src/main/java/org/bukkit/craftbukkit/CraftServer.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java (revision 2092b553cf3dbfc5fbe5534ac1bfd42e2c90a9fc)
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java (date 1609100597313)
@@ -351,13 +351,25 @@
if (pluginFolder.exists()) {
Plugin[] plugins = pluginManager.loadPlugins(pluginFolder);
+ List<Thread> threads = new ArrayList<>();
for (Plugin plugin : plugins) {
- try {
- String message = String.format("Loading %s", plugin.getDescription().getFullName());
- plugin.getLogger().info(message);
- plugin.onLoad();
- } catch (Throwable ex) {
- Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, ex.getMessage() + " initializing " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ Thread thread = new Thread(() -> {
+ try {
+ String message = String.format("Loading %s", plugin.getDescription().getFullName());
+ plugin.getLogger().info(message);
+ plugin.onLoad();
+ } catch (Throwable ex) {
+ Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, ex.getMessage() + " initializing " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ }
+ });
+ thread.start();
+ threads.add(thread);
+ }
+ for(Thread thread : threads){
+ try {
+ thread.join();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
}
}
} else {