aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/src/builder
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-17 14:40:26 -0500
committermat <github@matdoes.dev>2022-04-17 14:40:26 -0500
commit10cd1733cbba5c637fa0130a0cd7a7ab6e618226 (patch)
tree2767615fe92aa4481e3aabf503bc840def4320f9 /azalea-brigadier/src/builder
parent82ed6baea5c4e0d00f5fc2bbeb45cbb2838a3784 (diff)
downloadazalea-drasl-10cd1733cbba5c637fa0130a0cd7a7ab6e618226.tar.xz
add execute & get_integer
Diffstat (limited to 'azalea-brigadier/src/builder')
-rw-r--r--azalea-brigadier/src/builder/argument_builder.rs1
-rw-r--r--azalea-brigadier/src/builder/required_argument_builder.rs7
2 files changed, 5 insertions, 3 deletions
diff --git a/azalea-brigadier/src/builder/argument_builder.rs b/azalea-brigadier/src/builder/argument_builder.rs
index 1fb775c2..17e9d625 100644
--- a/azalea-brigadier/src/builder/argument_builder.rs
+++ b/azalea-brigadier/src/builder/argument_builder.rs
@@ -67,7 +67,6 @@ impl<S: Any + Clone> ArgumentBuilder<S> {
}
pub fn build(self) -> CommandNode<S> {
- println!("building {:?}", self);
CommandNode {
value: self.value,
diff --git a/azalea-brigadier/src/builder/required_argument_builder.rs b/azalea-brigadier/src/builder/required_argument_builder.rs
index 95f4da01..9cd089de 100644
--- a/azalea-brigadier/src/builder/required_argument_builder.rs
+++ b/azalea-brigadier/src/builder/required_argument_builder.rs
@@ -1,5 +1,8 @@
use super::argument_builder::{ArgumentBuilder, ArgumentBuilderType};
-use crate::{parsers::Parser, string_reader::StringReader};
+use crate::{
+ exceptions::command_syntax_exception::CommandSyntaxException, parsers::Parser,
+ string_reader::StringReader,
+};
use std::{any::Any, fmt::Debug, rc::Rc};
/// An argument node type. The `T` type parameter is the type of the argument,
@@ -17,7 +20,7 @@ impl Argument {
}
}
- pub fn parse(&self, reader: &mut StringReader) -> Option<Rc<dyn Any>> {
+ pub fn parse(&self, reader: &mut StringReader) -> Result<Rc<dyn Any>, CommandSyntaxException> {
self.parser.parse(reader)
}
}