[ci skip] merge pufferfish config relocatable patch into pufferfish issues patch

This commit is contained in:
granny
2024-12-20 14:42:16 -08:00
parent 908f1524fc
commit f06fd5bb38
44 changed files with 93 additions and 103 deletions

View File

@@ -0,0 +1,49 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: granny <granny@purpurmc.org>
Date: Sun, 5 May 2024 02:27:52 -0700
Subject: [PATCH] config for startup commands
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 827e8b9b0fb0fa64f56de54a562f65e200c7b50f..fa5f7bc53f3dfa5581f7c747c732ebc7737a7820 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1294,6 +1294,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
// Purpur end
+
+ // Purpur start
+ if (!Boolean.getBoolean("Purpur.IReallyDontWantStartupCommands") && !org.purpurmc.purpur.PurpurConfig.startupCommands.isEmpty()) {
+ LOGGER.info("Purpur: Running startup commands specified in purpur.yml.");
+ for (final String startupCommand : org.purpurmc.purpur.PurpurConfig.startupCommands) {
+ LOGGER.info("Purpur: Running the following command: \"{}\"", startupCommand);
+ ((DedicatedServer) this).handleConsoleInput(startupCommand, this.createCommandSourceStack());
+ }
+ }
+ // Purpur end
+
while (this.running) {
long i;
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 2d76827f83638c7f6bfa0d45bf950e18df22063e..66953d206d59c6e8ef3f925aca7451d57f98b81a 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -587,4 +587,16 @@ public class PurpurConfig {
private static void registerMinecraftDebugCommands() {
registerMinecraftDebugCommands = getBoolean("settings.register-minecraft-debug-commands", registerMinecraftDebugCommands);
}
+
+ public static List<String> startupCommands = new ArrayList<>();
+ private static void startupCommands() {
+ startupCommands.clear();
+ getList("settings.startup-commands", new ArrayList<String>()).forEach(line -> {
+ String command = line.toString();
+ if (command.startsWith("/")) {
+ command = command.substring(1);
+ }
+ startupCommands.add(command);
+ });
+ }
}