diff options
| author | mat <github@matdoes.dev> | 2022-04-17 16:52:34 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-04-17 16:52:34 -0500 |
| commit | 6f3c41e01c466e4ab6abd1268149dd88686bbbc9 (patch) | |
| tree | ccf6b49123995d5f42f20009514048a961a53c4b /azalea-brigadier/src/builder | |
| parent | 2e904225611b66fa72b082e4f5e188b55b333fcd (diff) | |
| download | azalea-drasl-6f3c41e01c466e4ab6abd1268149dd88686bbbc9.tar.xz | |
add .requires
Diffstat (limited to 'azalea-brigadier/src/builder')
| -rw-r--r-- | azalea-brigadier/src/builder/argument_builder.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/azalea-brigadier/src/builder/argument_builder.rs b/azalea-brigadier/src/builder/argument_builder.rs index 6f23457a..11c0062c 100644 --- a/azalea-brigadier/src/builder/argument_builder.rs +++ b/azalea-brigadier/src/builder/argument_builder.rs @@ -66,6 +66,14 @@ impl<S: Any + Clone> ArgumentBuilder<S> { self.clone() } + pub fn requires<F>(&mut self, requirement: F) -> Self + where + F: Fn(Rc<S>) -> bool + 'static, + { + self.requirement = Rc::new(requirement); + self.clone() + } + pub fn build(self) -> CommandNode<S> { CommandNode { value: self.value, |
