Skip to content

Commit

Permalink
♻️ 针对/ping重叠问题引入ExtensiveLiterCommandNode,用以特判管理指令树权限
Browse files Browse the repository at this point in the history
  • Loading branch information
wendavid552 committed Aug 2, 2024
1 parent 0fdd10d commit ee4be2b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package club.mcams.carpet.commands.commandNodes;

public class ExtensiveLiteralArgumentBuilder {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package club.mcams.carpet.commands.commandNodes;

import com.mojang.brigadier.Command;
import com.mojang.brigadier.RedirectModifier;
import com.mojang.brigadier.tree.CommandNode;
import com.mojang.brigadier.tree.LiteralCommandNode;

import java.util.function.Predicate;

public class ExtensiveLiteralCommandNode<S> extends LiteralCommandNode<S> {
private final Predicate<S> command_requirement;

public ExtensiveLiteralCommandNode(String literal, Command<S> command, Predicate<S> requirement, CommandNode<S> redirect, RedirectModifier<S> modifier, boolean forks) {
super(literal, command, requirement, redirect, modifier, forks);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

package club.mcams.carpet.mixin.rule.commandCustomCommandPermissionLevel;

import com.mojang.brigadier.Command;
import com.mojang.brigadier.tree.CommandNode;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
Expand All @@ -32,4 +33,7 @@ public interface CommandNodeInvoker<S> {
@Mutable
@Accessor("requirement")
void setRequirement(Predicate<S> requirement);

@Accessor("command")
void setCommand(Command<S> command);
}

0 comments on commit ee4be2b

Please sign in to comment.