Files
Purpur/patches/server/0280-register-minecraft-debug-commands.patch

48 lines
3.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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 13c084e250f298b2181abebe2c391dc172c0d49f..c6fe1a3760d620bd95a918d7b37d284d7161621c 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -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
+ if (!org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands) TestCommand.register(this.dispatcher); // Purpur
RaidCommand.register(this.dispatcher, commandRegistryAccess);
DebugPathCommand.register(this.dispatcher);
DebugMobSpawningCommand.register(this.dispatcher);
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 824afdc486a50952bf5e32b06509f7952da9bba5..abb60e5cf3ecdb40561510dc53294e3010fbe039 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -122,6 +122,7 @@ public class Main {
// Purpur start - load config files early
org.bukkit.configuration.file.YamlConfiguration purpurConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("purpur-settings"));
org.purpurmc.purpur.PurpurConfig.clampEnchantLevels = purpurConfiguration.getBoolean("settings.enchantment.clamp-levels");
+ org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands = purpurConfiguration.getBoolean("settings.register-minecraft-debug-commands");
// Purpur end - load config files early
io.papermc.paper.plugin.PluginInitializerManager.load(optionset); // Paper
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index f93224fe05c29cdecf5e04afec1624a4edfbb77b..a6681c9e0ba0544bf1fd80d73be7f22f4fed1157 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -567,4 +567,9 @@ public class PurpurConfig {
private static void playerDeathsAlwaysShowItem() {
playerDeathsAlwaysShowItem = getBoolean("settings.player-deaths-always-show-item", playerDeathsAlwaysShowItem);
}
+
+ public static boolean registerMinecraftDebugCommands = false;
+ private static void registerMinecraftDebugCommands() {
+ registerMinecraftDebugCommands = getBoolean("settings.register-minecraft-debug-commands", registerMinecraftDebugCommands);
+ }
}