9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00

Force Minecraft command

This commit is contained in:
NONPLAYT
2025-03-10 00:41:17 +03:00
parent bbc0f71f39
commit 227a74a1ee
2 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
--- a/src/main/java/org/bukkit/craftbukkit/command/CraftCommandMap.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/CraftCommandMap.java
@@ -14,4 +_,18 @@
public Map<String, Command> getKnownCommands() {
return this.knownCommands;
}
+
+ // DivineMC start - Force Minecraft command
+ @Override
+ public Command getCommand(String name) {
+ Command target = super.getCommand(name);
+ if (org.bxteam.divinemc.DivineConfig.forceMinecraftCommand && !(target instanceof org.bukkit.craftbukkit.command.VanillaCommandWrapper)) {
+ Command minecraftTarget = super.getCommand("minecraft:" + name);
+ if (minecraftTarget != null) {
+ return minecraftTarget;
+ }
+ }
+ return target;
+ }
+ // DivineMC end - Force Minecraft command
}

View File

@@ -286,6 +286,7 @@ public class DivineConfig {
public static boolean updateSuppressionCrashFix = true;
public static boolean useCompactBitStorage = false;
public static boolean fixIncorrectBounceLogic = false;
public static boolean forceMinecraftCommand = false;
private static void miscSettings() {
skipUselessSecondaryPoiSensor = getBoolean("settings.misc.skip-useless-secondary-poi-sensor", skipUselessSecondaryPoiSensor);
clumpOrbs = getBoolean("settings.misc.clump-orbs", clumpOrbs,
@@ -299,6 +300,8 @@ public class DivineConfig {
"Fixes memory waste caused by sending empty chunks as if they contain blocks. Can significantly reduce memory usage.");
fixIncorrectBounceLogic = getBoolean("settings.misc.fix-incorrect-bounce-logic", fixIncorrectBounceLogic,
"Fixes incorrect bounce logic in SlimeBlock.");
forceMinecraftCommand = getBoolean("settings.misc.force-minecraft-command", forceMinecraftCommand,
"Whether to force the use of vanilla commands over plugin commands.");
}
public static boolean disableDisconnectSpam = false;