mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
34 lines
1.7 KiB
Diff
34 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
|
|
Date: Sat, 29 Nov 2025 23:32:57 +0800
|
|
Subject: [PATCH] Force minecraft command
|
|
|
|
|
|
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
|
index 83f05b042630891d43cfb567e98666831df80f6e..f7990278fe2e112025fffe9bfa3649db7aa4150a 100644
|
|
--- a/net/minecraft/commands/Commands.java
|
|
+++ b/net/minecraft/commands/Commands.java
|
|
@@ -176,7 +176,21 @@ public class Commands {
|
|
return node.getRequirement() instanceof PermissionCheck<?> permissionCheck && permissionCheck.requiredLevel() > 0;
|
|
}
|
|
};
|
|
- private final CommandDispatcher<CommandSourceStack> dispatcher = new CommandDispatcher<>();
|
|
+ // Leaves start - force minecraft command
|
|
+ private final CommandDispatcher<CommandSourceStack> dispatcher = new CommandDispatcher<>() {
|
|
+
|
|
+ @Override
|
|
+ public com.mojang.brigadier.tree.LiteralCommandNode<CommandSourceStack> register(com.mojang.brigadier.builder.LiteralArgumentBuilder<net.minecraft.commands.CommandSourceStack> command) {
|
|
+ try {
|
|
+ if (org.leavesmc.leaves.LeavesConfig.mics.forceMinecraftCommand && getRoot().getChild("minecraft:" + command.getLiteral()) != null) {
|
|
+ return command.build();
|
|
+ }
|
|
+ } catch (Exception ignored) {
|
|
+ }
|
|
+ return super.register(command);
|
|
+ }
|
|
+ };
|
|
+ // Leaves end - force minecraft command
|
|
|
|
public Commands(Commands.CommandSelection selection, CommandBuildContext context) {
|
|
// Paper start - Brigadier API - modern minecraft overloads that do not use redirects but are copies instead
|