From 315f2258190b33c63df7797a97178019f5aea02b Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 9 Jan 2022 22:33:45 -0600 Subject: add some more stuff from brigadier --- azalea-brigadier/src/tree/command_node.rs | 52 +++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'azalea-brigadier/src/tree/command_node.rs') diff --git a/azalea-brigadier/src/tree/command_node.rs b/azalea-brigadier/src/tree/command_node.rs index e69de29b..286820b9 100644 --- a/azalea-brigadier/src/tree/command_node.rs +++ b/azalea-brigadier/src/tree/command_node.rs @@ -0,0 +1,52 @@ +use std::collections::HashMap; + +use crate::{ + builder::argument_builder::ArgumentBuilder, + command::Command, + context::{command_context::CommandContext, command_context_builder::CommandContextBuilder}, + exceptions::command_syntax_exception::CommandSyntaxException, + redirect_modifier::RedirectModifier, + string_reader::StringReader, + suggestion::{suggestions::Suggestions, suggestions_builder::SuggestionsBuilder}, +}; + +use super::{argument_command_node::ArgumentCommandNode, literal_command_node::LiteralCommandNode}; + +pub struct BaseCommandNode { + // private final Map> children = new LinkedHashMap<>(); + // private final Map> literals = new LinkedHashMap<>(); + // private final Map> arguments = new LinkedHashMap<>(); + // private final Predicate requirement; + // private final CommandNode redirect; + // private final RedirectModifier modifier; + // private final boolean forks; + // private Command command; + children: HashMap>, + literals: HashMap>, + arguments: HashMap>, + requirement: Option bool>, + redirect: Option>, + modifier: Option>, + forks: bool, + command: Option>, +} + +impl BaseCommandNode {} + +pub trait CommandNode { + fn name(&self) -> &str; + fn usage_text(&self) -> &str; + fn parse( + &self, + reader: StringReader, + context_builder: CommandContextBuilder, + ) -> Result<(), CommandSyntaxException>; + fn list_suggestions( + &self, + context: CommandContext, + builder: SuggestionsBuilder, + ) -> Result; + fn is_valid_input(&self, input: &str) -> bool; + fn create_builder(&self) -> dyn ArgumentBuilder; + fn get_examples(&self) -> Vec; +} -- cgit v1.2.3