aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/src/arguments
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-01-09 22:33:45 -0600
committermat <github@matdoes.dev>2022-01-09 22:33:45 -0600
commit315f2258190b33c63df7797a97178019f5aea02b (patch)
tree1ec5f467e7bd42f7aed3aaadbcbc226f8a6ce4f2 /azalea-brigadier/src/arguments
parentd56f60c05f316ab4cc37ebe7a9ad4caf91a75de6 (diff)
downloadazalea-drasl-315f2258190b33c63df7797a97178019f5aea02b.tar.xz
add some more stuff from brigadier
Diffstat (limited to 'azalea-brigadier/src/arguments')
-rw-r--r--azalea-brigadier/src/arguments/argument_type.rs4
-rw-r--r--azalea-brigadier/src/arguments/bool_argument_type.rs25
-rw-r--r--azalea-brigadier/src/arguments/mod.rs6
3 files changed, 26 insertions, 9 deletions
diff --git a/azalea-brigadier/src/arguments/argument_type.rs b/azalea-brigadier/src/arguments/argument_type.rs
index 4c48d6bb..34d57285 100644
--- a/azalea-brigadier/src/arguments/argument_type.rs
+++ b/azalea-brigadier/src/arguments/argument_type.rs
@@ -5,7 +5,7 @@ use crate::{
suggestion::{suggestions::Suggestions, suggestions_builder::SuggestionsBuilder},
};
-pub trait ArgumentType<T> {
+pub trait ArgumentType {
// T parse(StringReader reader) throws CommandSyntaxException;
// default <S> CompletableFuture<Suggestions> listSuggestions(final CommandContext<S> context, final SuggestionsBuilder builder) {
@@ -16,7 +16,7 @@ pub trait ArgumentType<T> {
// return Collections.emptyList();
// }
- fn parse(reader: &mut StringReader) -> Result<T, CommandSyntaxException>;
+ fn parse<T>(reader: &mut StringReader) -> Result<T, CommandSyntaxException>;
fn list_suggestions<S>(
context: &CommandContext<S>,
diff --git a/azalea-brigadier/src/arguments/bool_argument_type.rs b/azalea-brigadier/src/arguments/bool_argument_type.rs
index d4a33517..f4c03373 100644
--- a/azalea-brigadier/src/arguments/bool_argument_type.rs
+++ b/azalea-brigadier/src/arguments/bool_argument_type.rs
@@ -1,8 +1,19 @@
-struct BoolArgumentType {
- // private static final Collection<String> EXAMPLES = Arrays.asList("true", "false");
- const EXAMPLES: &'static [&'static str] = &["true", "false"];
-}
+use crate::context::command_context::CommandContext;
+
+use super::argument_type::ArgumentType;
+
+struct BoolArgumentType {}
+
+impl ArgumentType for BoolArgumentType {}
-impl ArgumentType for BoolArgumentType {
-
-} \ No newline at end of file
+impl BoolArgumentType {
+ const EXAMPLES: &'static [&'static str] = &["true", "false"];
+
+ fn bool() -> Self {
+ Self {}
+ }
+
+ fn get_bool<S>(context: CommandContext<S>, name: String) {
+ context.get_argument::<bool>(name)
+ }
+}
diff --git a/azalea-brigadier/src/arguments/mod.rs b/azalea-brigadier/src/arguments/mod.rs
index 50b0f09b..487c5db7 100644
--- a/azalea-brigadier/src/arguments/mod.rs
+++ b/azalea-brigadier/src/arguments/mod.rs
@@ -1 +1,7 @@
pub mod argument_type;
+pub mod bool_argument_type;
+pub mod double_argument_type;
+pub mod float_argument_type;
+pub mod integer_argument_type;
+pub mod long_argument_type;
+pub mod string_argument_type;