Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
radstevee committed Dec 29, 2024
1 parent b86d99a commit 5755121
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
16 changes: 13 additions & 3 deletions src/lib/default_commands/src/echo.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
use std::sync::Arc;

use ferrumc_commands::{
arg::{parser::{string::GreedyStringParser, ArgumentParser}, CommandArgument}, ctx::CommandContext, executor,
infrastructure::register_command, Command, CommandResult,
arg::{
parser::{string::GreedyStringParser, ArgumentParser},
CommandArgument,
},
ctx::CommandContext,
executor,
infrastructure::register_command,
Command, CommandResult,
};
use ferrumc_core::identity::player_identity::PlayerIdentity;
use ferrumc_macros::{arg, command};
Expand All @@ -12,7 +18,11 @@ use ferrumc_text::{NamedColor, TextComponentBuilder};
#[command("echo")]
async fn echo(ctx: Arc<CommandContext>) -> CommandResult {
let message = ctx.arg::<String>("message");
let identity = ctx.state.universe.get::<PlayerIdentity>(ctx.connection_id).expect("failed to get identity");
let identity = ctx
.state
.universe
.get::<PlayerIdentity>(ctx.connection_id)
.expect("failed to get identity");

ctx.reply(
TextComponentBuilder::new(format!("{} said: {message}", identity.username))
Expand Down
3 changes: 2 additions & 1 deletion src/lib/derive_macros/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use std::{
use proc_macro::TokenStream;
use quote::{format_ident, quote, ToTokens};
use syn::{
parse::{Parse, ParseStream}, parse_macro_input, Expr, Ident, ItemFn, LitBool, LitStr, Result as SynResult, Token
parse::{Parse, ParseStream},
parse_macro_input, Expr, ItemFn, LitBool, LitStr, Result as SynResult, Token,
};

static PENDING_ARGS: OnceLock<Mutex<HashMap<String, Vec<ArgAttr>>>> = OnceLock::new();
Expand Down

0 comments on commit 5755121

Please sign in to comment.