diff options
| author | mat <github@matdoes.dev> | 2022-04-17 18:36:14 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-04-17 18:36:14 -0500 |
| commit | af4b0d0add23188ab00e89a216cd3db62074cf7e (patch) | |
| tree | debd9420fab175004f157dc308102b9b35432895 /azalea-brigadier/src/builder | |
| parent | 14625e2bce15eeef35d2ae7fcce1e21a491f32aa (diff) | |
| download | azalea-drasl-af4b0d0add23188ab00e89a216cd3db62074cf7e.tar.xz | |
Implement working redirects
Diffstat (limited to 'azalea-brigadier/src/builder')
| -rw-r--r-- | azalea-brigadier/src/builder/argument_builder.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/azalea-brigadier/src/builder/argument_builder.rs b/azalea-brigadier/src/builder/argument_builder.rs index f17fe4fa..3c9ae3ed 100644 --- a/azalea-brigadier/src/builder/argument_builder.rs +++ b/azalea-brigadier/src/builder/argument_builder.rs @@ -1,7 +1,7 @@ use crate::{context::CommandContext, modifier::RedirectModifier, tree::CommandNode}; use super::{literal_argument_builder::Literal, required_argument_builder::Argument}; -use std::{any::Any, cell::RefCell, collections::BTreeMap, fmt::Debug, rc::Rc}; +use std::{any::Any, cell::RefCell, fmt::Debug, rc::Rc}; #[derive(Debug, Clone)] pub enum ArgumentBuilderType { @@ -38,6 +38,7 @@ impl<S: Any + Clone> ArgumentBuilder<S> { } } + // do we need to be cloning here? maybe we could return a ref to self? pub fn then(&mut self, argument: ArgumentBuilder<S>) -> Self { self.arguments .add_child(&Rc::new(RefCell::new(argument.build()))); @@ -82,10 +83,10 @@ impl<S: Any + Clone> ArgumentBuilder<S> { pub fn build(self) -> CommandNode<S> { let mut result = CommandNode { value: self.arguments.value, - command: self.command.clone(), - requirement: self.requirement.clone(), - redirect: self.target.clone(), - modifier: self.modifier.clone(), + command: self.command, + requirement: self.requirement, + redirect: self.target, + modifier: self.modifier, forks: self.forks, ..Default::default() }; |
