diff --git a/patches/server/Add-plugin-info-at-startup.patch b/patches/server/Add-plugin-info-at-startup.patch new file mode 100644 index 0000000000..89c55bd39b --- /dev/null +++ b/patches/server/Add-plugin-info-at-startup.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Thu, 18 Jul 2024 18:44:28 -0700 +Subject: [PATCH] Add plugin info at startup + + +diff --git a/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java b/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java ++++ b/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java +@@ -0,0 +0,0 @@ import io.papermc.paper.plugin.entrypoint.Entrypoint; + import io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler; + import io.papermc.paper.plugin.provider.PluginProvider; + import io.papermc.paper.plugin.provider.type.paper.PaperPluginParent; ++import io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider; + import io.papermc.paper.pluginremap.PluginRemapper; ++import java.util.Set; ++import java.util.TreeSet; + import java.util.function.Function; + import joptsimple.OptionSet; + import net.minecraft.server.dedicated.DedicatedServer; +@@ -0,0 +0,0 @@ public class PluginInitializerManager { + } + + public static void load(OptionSet optionSet) throws Exception { ++ LOGGER.info("Initializing plugins..."); + // We have to load the bukkit configuration inorder to get the update folder location. + io.papermc.paper.plugin.PluginInitializerManager pluginSystem = io.papermc.paper.plugin.PluginInitializerManager.init(optionSet); + if (pluginSystem.pluginRemapper != null) pluginSystem.pluginRemapper.loadingPlugins(); +@@ -0,0 +0,0 @@ public class PluginInitializerManager { + @SuppressWarnings("unchecked") + java.util.List files = ((java.util.List) optionSet.valuesOf("add-plugin")).stream().map(File::toPath).toList(); + io.papermc.paper.plugin.util.EntrypointUtil.registerProvidersFromSource(io.papermc.paper.plugin.provider.source.PluginFlagProviderSource.INSTANCE, files); ++ ++ final Set paperPluginNames = new TreeSet<>(); ++ final Set legacyPluginNames = new TreeSet<>(); ++ LaunchEntryPointHandler.INSTANCE.getStorage().forEach((entrypoint, providerStorage) -> { ++ providerStorage.getRegisteredProviders().forEach(provider -> { ++ if (provider instanceof final SpigotPluginProvider legacy) { ++ legacyPluginNames.add(String.format("%s (%s)", legacy.getMeta().getName(), legacy.getMeta().getVersion())); ++ } else if (provider instanceof final PaperPluginParent.PaperServerPluginProvider paper) { ++ paperPluginNames.add(String.format("%s (%s)", provider.getMeta().getName(), provider.getMeta().getVersion())); ++ } ++ }); ++ }); ++ final int total = paperPluginNames.size() + legacyPluginNames.size(); ++ LOGGER.info("Initialized {} plugin{}", total, total == 1 ? "" : "s"); ++ if (!paperPluginNames.isEmpty()) { ++ if (LOGGER.isDebugEnabled()) { ++ LOGGER.info("Paper plugins ({}):\n - {}", paperPluginNames.size(), String.join("\n - ", paperPluginNames)); ++ } else { ++ LOGGER.info("Paper plugins ({}):\n - {}", paperPluginNames.size(), String.join(", ", paperPluginNames)); ++ } ++ } ++ if (!legacyPluginNames.isEmpty()) { ++ if (LOGGER.isDebugEnabled()) { ++ LOGGER.info("Bukkit plugins ({}):\n - {}", legacyPluginNames.size(), String.join("\n - ", legacyPluginNames)); ++ } else { ++ LOGGER.info("Bukkit plugins ({}):\n - {}", legacyPluginNames.size(), String.join(", ", legacyPluginNames)); ++ } ++ } + } + + // This will be the end of me... diff --git a/patches/server/Expose-server-build-information.patch b/patches/server/Expose-server-build-information.patch index 6f6c38aa08..6f7bbc0108 100644 --- a/patches/server/Expose-server-build-information.patch +++ b/patches/server/Expose-server-build-information.patch @@ -361,6 +361,67 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } +} +diff --git a/src/main/java/io/papermc/paper/PaperBootstrap.java b/src/main/java/io/papermc/paper/PaperBootstrap.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/PaperBootstrap.java +@@ -0,0 +0,0 @@ ++package io.papermc.paper; ++ ++import java.util.List; ++import joptsimple.OptionSet; ++import net.minecraft.SharedConstants; ++import net.minecraft.server.Main; ++import org.slf4j.Logger; ++import org.slf4j.LoggerFactory; ++ ++public final class PaperBootstrap { ++ private static final Logger LOGGER = LoggerFactory.getLogger("bootstrap"); ++ ++ private PaperBootstrap() { ++ } ++ ++ public static void boot(final OptionSet options) { ++ SharedConstants.tryDetectVersion(); ++ ++ getStartupVersionMessages().forEach(LOGGER::info); ++ ++ Main.main(options); ++ } ++ ++ private static List getStartupVersionMessages() { ++ final String javaSpecVersion = System.getProperty("java.specification.version"); ++ final String javaVmName = System.getProperty("java.vm.name"); ++ final String javaVmVersion = System.getProperty("java.vm.version"); ++ final String javaVendor = System.getProperty("java.vendor"); ++ final String javaVendorVersion = System.getProperty("java.vendor.version"); ++ final String osName = System.getProperty("os.name"); ++ final String osVersion = System.getProperty("os.version"); ++ final String osArch = System.getProperty("os.arch"); ++ ++ final ServerBuildInfo bi = ServerBuildInfo.buildInfo(); ++ return List.of( ++ String.format( ++ "Running Java %s (%s %s; %s %s) on %s %s (%s)", ++ javaSpecVersion, ++ javaVmName, ++ javaVmVersion, ++ javaVendor, ++ javaVendorVersion, ++ osName, ++ osVersion, ++ osArch ++ ), ++ String.format( ++ "Loading %s %s for Minecraft %s", ++ bi.brandName(), ++ bi.asString(ServerBuildInfo.StringRepresentation.VERSION_FULL), ++ bi.minecraftVersionId() ++ ) ++ ); ++ } ++} diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -621,22 +682,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } System.setProperty("library.jansi.version", "Paper"); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows -+ // Paper start - Log Java and OS versioning to help with debugging plugin issues -+ java.lang.management.RuntimeMXBean runtimeMX = java.lang.management.ManagementFactory.getRuntimeMXBean(); -+ java.lang.management.OperatingSystemMXBean osMX = java.lang.management.ManagementFactory.getOperatingSystemMXBean(); -+ if (runtimeMX != null && osMX != null) { -+ String javaInfo = "Java " + runtimeMX.getSpecVersion() + " (" + runtimeMX.getVmName() + " " + runtimeMX.getVmVersion() + ")"; -+ String osInfo = "Host: " + osMX.getName() + " " + osMX.getVersion() + " (" + osMX.getArch() + ")"; +- System.out.println("Loading libraries, please wait..."); +- net.minecraft.server.Main.main(options); + -+ System.out.println("System Info: " + javaInfo + " " + osInfo); -+ } else { -+ System.out.println("Unable to read system info"); -+ } -+ // Paper end - Log Java and OS versioning to help with debugging plugin issues -+ - System.out.println("Loading libraries, please wait..."); - net.minecraft.server.Main.main(options); ++ //System.out.println("Loading libraries, please wait..."); ++ //net.minecraft.server.Main.main(options); ++ io.papermc.paper.PaperBootstrap.boot(options); } catch (Throwable t) { + t.printStackTrace(); + } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java