From 4ff67d4917ce333232189e86aee09f2d82451fc6 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 3 Feb 2022 02:16:24 +0000 Subject: a --- azalea-brigadier/src/tree/literal_command_node.rs | 30 ++++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'azalea-brigadier/src/tree/literal_command_node.rs') diff --git a/azalea-brigadier/src/tree/literal_command_node.rs b/azalea-brigadier/src/tree/literal_command_node.rs index 253b6dc5..2db31d97 100644 --- a/azalea-brigadier/src/tree/literal_command_node.rs +++ b/azalea-brigadier/src/tree/literal_command_node.rs @@ -3,33 +3,45 @@ use crate::{ builder::{ argument_builder::ArgumentBuilder, literal_argument_builder::LiteralArgumentBuilder, }, + command::Command, context::{command_context::CommandContext, command_context_builder::CommandContextBuilder}, exceptions::{ builtin_exceptions::BuiltInExceptions, command_syntax_exception::CommandSyntaxException, }, immutable_string_reader::ImmutableStringReader, + redirect_modifier::RedirectModifier, string_reader::StringReader, suggestion::{suggestions::Suggestions, suggestions_builder::SuggestionsBuilder}, }; -use std::fmt::Debug; +use std::{collections::HashMap, fmt::Debug}; -use super::command_node::{BaseCommandNode, CommandNodeTrait}; +use super::{ + argument_command_node::ArgumentCommandNode, + command_node::{BaseCommandNode, CommandNodeTrait}, +}; #[derive(Debug, Clone)] -pub struct LiteralCommandNode<'a, S> { +pub struct LiteralCommandNode { literal: String, literal_lowercase: String, - // Since Rust doesn't have extending, we put the struct this is extending as the "base" field - pub base: BaseCommandNode<'a, S>, + + children: HashMap>>, + literals: HashMap>, + arguments: HashMap>, + pub requirement: Box bool>, + redirect: Option>>, + modifier: Option>>, + forks: bool, + pub command: Option>>, } -impl<'a, S> LiteralCommandNode<'a, S> { - pub fn new(literal: String, base: BaseCommandNode<'a, S>) -> Self { +impl LiteralCommandNode { + pub fn new(literal: String) -> Self { let literal_lowercase = literal.to_lowercase(); Self { literal, literal_lowercase, - base, + ..Default::default() } } @@ -54,7 +66,7 @@ impl<'a, S> LiteralCommandNode<'a, S> { } } -impl CommandNodeTrait for LiteralCommandNode<'_, S> { +impl CommandNodeTrait for LiteralCommandNode { fn name(&self) -> &str { &self.literal } -- cgit v1.2.3