mirror of
https://github.com/mat-1/azalea.git
synced 2024-09-19 14:42:32 +00:00
work a bit on brigadier
This commit is contained in:
parent
fec7a2bfed
commit
cb4d871f6f
4 changed files with 25 additions and 11 deletions
|
@ -1,3 +1,4 @@
|
|||
use super::bool_argument_type::BoolArgumentType;
|
||||
use crate::{
|
||||
context::command_context::CommandContext,
|
||||
exceptions::command_syntax_exception::CommandSyntaxException,
|
||||
|
@ -5,12 +6,27 @@ use crate::{
|
|||
suggestion::{suggestions::Suggestions, suggestions_builder::SuggestionsBuilder},
|
||||
};
|
||||
|
||||
pub trait ArgumentResult {}
|
||||
pub enum DefaultArguments {
|
||||
Bool(BoolArgumentType),
|
||||
}
|
||||
|
||||
pub trait ArgumentType<T>
|
||||
where
|
||||
T: ArgumentResult,
|
||||
{
|
||||
/*
|
||||
define_arguments! {
|
||||
Entity(EntityArgumentType)
|
||||
}
|
||||
|
||||
===
|
||||
|
||||
enum CustomArguments {
|
||||
Entity(EntityArgumentType)
|
||||
}
|
||||
enum BrigadierArguments {
|
||||
BuiltIn(DefaultArguments)
|
||||
Custom(CustomArguments)
|
||||
}
|
||||
*/
|
||||
|
||||
pub trait ArgumentType<T> {
|
||||
// T parse(StringReader reader) throws CommandSyntaxException;
|
||||
|
||||
// default <S> CompletableFuture<Suggestions> listSuggestions(final CommandContext<S> context, final SuggestionsBuilder builder) {
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::context::command_context::CommandContext;
|
|||
|
||||
use super::argument_type::ArgumentType;
|
||||
|
||||
struct BoolArgumentType {}
|
||||
pub struct BoolArgumentType {}
|
||||
|
||||
impl ArgumentType<bool> for BoolArgumentType {}
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
arguments::argument_type::{ArgumentResult, ArgumentType},
|
||||
command::Command,
|
||||
command_dispatcher::CommandDispatcher,
|
||||
redirect_modifier::RedirectModifier,
|
||||
arguments::argument_type::ArgumentType, command::Command,
|
||||
command_dispatcher::CommandDispatcher, redirect_modifier::RedirectModifier,
|
||||
tree::command_node::CommandNode,
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ use super::{argument_command_node::ArgumentCommandNode, literal_command_node::Li
|
|||
pub struct BaseCommandNode<S> {
|
||||
children: HashMap<String, dyn CommandNode<S>>,
|
||||
literals: HashMap<String, LiteralCommandNode<S>>,
|
||||
arguments: HashMap<String, ArgumentCommandNode<S, dyn ArgumentType<dyn ArgumentResult>>>,
|
||||
arguments: HashMap<String, ArgumentCommandNode<S, dyn ArgumentType<ArgumentResult>>>,
|
||||
requirement: Option<dyn Fn(&S) -> bool>,
|
||||
redirect: Option<dyn CommandNode<S>>,
|
||||
modifier: Option<dyn RedirectModifier<S>>,
|
||||
|
|
Loading…
Reference in a new issue