aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/src
diff options
context:
space:
mode:
authorUbuntu <github@matdoes.dev>2022-01-11 00:42:30 +0000
committerUbuntu <github@matdoes.dev>2022-01-11 00:42:30 +0000
commitcb4d871f6f56a484dc87151ea3ad55f7e3bbed97 (patch)
tree743377adb4103f3a0ecbec5788a71d3bf6c0a3d0 /azalea-brigadier/src
parentfec7a2bfedc562306523b9d3c51b97e376dc32d9 (diff)
downloadazalea-drasl-cb4d871f6f56a484dc87151ea3ad55f7e3bbed97.tar.xz
work a bit on brigadier
Diffstat (limited to 'azalea-brigadier/src')
-rw-r--r--azalea-brigadier/src/arguments/argument_type.rs26
-rw-r--r--azalea-brigadier/src/arguments/bool_argument_type.rs2
-rw-r--r--azalea-brigadier/src/context/command_context_builder.rs6
-rw-r--r--azalea-brigadier/src/tree/command_node.rs2
4 files changed, 25 insertions, 11 deletions
diff --git a/azalea-brigadier/src/arguments/argument_type.rs b/azalea-brigadier/src/arguments/argument_type.rs
index ea453a1a..f5ca457b 100644
--- a/azalea-brigadier/src/arguments/argument_type.rs
+++ b/azalea-brigadier/src/arguments/argument_type.rs
@@ -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),
+}
+
+/*
+define_arguments! {
+ Entity(EntityArgumentType)
+}
+
+===
+
+enum CustomArguments {
+ Entity(EntityArgumentType)
+}
+enum BrigadierArguments {
+ BuiltIn(DefaultArguments)
+ Custom(CustomArguments)
+}
+*/
-pub trait ArgumentType<T>
-where
- T: ArgumentResult,
-{
+pub trait ArgumentType<T> {
// T parse(StringReader reader) throws CommandSyntaxException;
// default <S> CompletableFuture<Suggestions> listSuggestions(final CommandContext<S> context, final SuggestionsBuilder builder) {
diff --git a/azalea-brigadier/src/arguments/bool_argument_type.rs b/azalea-brigadier/src/arguments/bool_argument_type.rs
index 74df3331..9bdf42e5 100644
--- a/azalea-brigadier/src/arguments/bool_argument_type.rs
+++ b/azalea-brigadier/src/arguments/bool_argument_type.rs
@@ -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 {}
diff --git a/azalea-brigadier/src/context/command_context_builder.rs b/azalea-brigadier/src/context/command_context_builder.rs
index ac4a36bb..5766ea9a 100644
--- a/azalea-brigadier/src/context/command_context_builder.rs
+++ b/azalea-brigadier/src/context/command_context_builder.rs
@@ -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,
};
diff --git a/azalea-brigadier/src/tree/command_node.rs b/azalea-brigadier/src/tree/command_node.rs
index 717ea5f1..0d9212aa 100644
--- a/azalea-brigadier/src/tree/command_node.rs
+++ b/azalea-brigadier/src/tree/command_node.rs
@@ -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>>,