From af4b0d0add23188ab00e89a216cd3db62074cf7e Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 17 Apr 2022 18:36:14 -0500 Subject: Implement working redirects --- azalea-brigadier/src/tree.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'azalea-brigadier/src/tree.rs') diff --git a/azalea-brigadier/src/tree.rs b/azalea-brigadier/src/tree.rs index 5c33a879..b68fbdcf 100644 --- a/azalea-brigadier/src/tree.rs +++ b/azalea-brigadier/src/tree.rs @@ -32,15 +32,6 @@ pub struct CommandNode { } impl CommandNode { - // pub fn new() - // TODO: precalculate `literals` and `arguments` and include them in CommandNode - fn literals(&self) -> &BTreeMap>>> { - &self.literals - } - fn arguments(&self) -> &BTreeMap>>> { - &self.arguments - } - /// Gets the literal, or panics. You should use match if you're not certain about the type. pub fn literal(&self) -> &Literal { match self.value { @@ -57,7 +48,7 @@ impl CommandNode { } pub fn get_relevant_nodes(&self, input: &mut StringReader) -> Vec>>> { - let literals = self.literals(); + let literals = &self.literals; if !literals.is_empty() { let cursor = input.cursor(); @@ -75,10 +66,10 @@ impl CommandNode { if let Some(literal) = literal { return vec![literal.clone()]; } else { - return self.arguments().values().cloned().collect(); + return self.arguments.values().cloned().collect(); } } else { - self.arguments().values().cloned().collect() + self.arguments.values().cloned().collect() } } @@ -245,8 +236,7 @@ impl PartialEq for CommandNode { } else { return false; } - } - else if other.command.is_some() { + } else if other.command.is_some() { return false; } true -- cgit v1.2.3