Skip to content

Commit

Permalink
load config early for registerMinecraftDebugCommands option
Browse files Browse the repository at this point in the history
  • Loading branch information
granny committed Feb 19, 2024
1 parent 8f371ac commit ec60d48
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions patches/server/0306-register-minecraft-debug-commands.patch
Original file line number Diff line number Diff line change
@@ -1,22 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: granny <granny@purpurmc.org>
From: granny <contact@granny.dev>
Date: Sun, 18 Feb 2024 16:28:32 -0800
Subject: [PATCH] register minecraft debug commands


diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index b6cc108c2d4361e6f415cfc3ff8c7699a8e222f4..4b88c94816645eb9a1b438f6e9312b5b5fd8d0a7 100644
index b6cc108c2d4361e6f415cfc3ff8c7699a8e222f4..b203394ed62807e7d5df433830993f1d2ee14939 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -221,7 +221,7 @@ public class Commands {
@@ -221,8 +221,8 @@ public class Commands {
JfrCommand.register(this.dispatcher);
}

- if (SharedConstants.IS_RUNNING_IN_IDE) {
- TestCommand.register(this.dispatcher);
+ if (org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands || SharedConstants.IS_RUNNING_IN_IDE) { // Purpur
TestCommand.register(this.dispatcher);
+ if (!org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands) TestCommand.register(this.dispatcher); // Purpur
ResetChunksCommand.register(this.dispatcher);
RaidCommand.register(this.dispatcher);
DebugPathCommand.register(this.dispatcher);
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 61840cfd64caba6595dfc99c91c76a195638d4ee..b4a009a1108758110181af3321a91b3ec9cf74dc 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -141,6 +141,10 @@ public class Main {
// Paper start - load config files early for access below if needed
org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings"));
org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings"));
+ // Purpur start
+ org.bukkit.configuration.file.YamlConfiguration purpurConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("purpur-settings"));
+ org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands = purpurConfiguration.getBoolean("settings.register-minecraft-debug-commands");
+ // Purpur end
// Paper end - load config files early for access below if needed

if (optionset.has("initSettings")) { // CraftBukkit
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 776d397fc31db121fa933a2ae2b4f1589fc10247..efe25d3894f3ad000257c72d9a5e06ef22446d41 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
Expand Down

0 comments on commit ec60d48

Please sign in to comment.