From 17d9f676ccdc69743e7717bb91f7ff2999c065f8 Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 18 Apr 2022 17:59:21 +0000 Subject: general cleanup --- azalea-brigadier/src/lib.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'azalea-brigadier/src/lib.rs') diff --git a/azalea-brigadier/src/lib.rs b/azalea-brigadier/src/lib.rs index d3db8dcf..e359e274 100644 --- a/azalea-brigadier/src/lib.rs +++ b/azalea-brigadier/src/lib.rs @@ -17,6 +17,7 @@ mod tests { use crate::{ builder::{literal_argument_builder::literal, required_argument_builder::argument}, + context::CommandContext, dispatcher::CommandDispatcher, parsers::{get_integer, integer}, }; @@ -27,7 +28,7 @@ mod tests { #[test] fn it_works() { - let mut dispatcher = CommandDispatcher::::new(); + let mut dispatcher = CommandDispatcher::new(); let source = Rc::new(CommandSourceStack { player: "player".to_string(), @@ -35,11 +36,17 @@ mod tests { dispatcher.register( literal("foo") - .then(argument("bar", integer()).executes(|c| { - println!("Bar is {:?}", get_integer(c, "bar")); - 2 - })) - .executes(|c| { + .then(argument("bar", integer()).executes( + |c: &CommandContext| { + println!( + "Bar is {:?} and player is {}", + get_integer(c, "bar"), + c.source.player + ); + 2 + }, + )) + .executes(|_| { println!("Called foo with no arguments"); 1 }), -- cgit v1.2.3