refactor(commands): from async to sync Part 3
This commit is contained in:
1 parent
5d841d6d3b
commit
66a5f53408
222 files changed
+11699
-12920
No files matched your search
@@ -27,23 +27,14 @@ impl GetClientSideArgParser for ParticleArgumentConsumer {
|
||||
}
|
||||
|
||||
impl ArgumentConsumer for ParticleArgumentConsumer {
|
||||
fn consume<'a, 'b>(
|
||||
fn consume<'a>(
|
||||
&'a self,
|
||||
_sender: &'a CommandSender,
|
||||
_server: &'a Server,
|
||||
args: &'b mut RawArgs<'a>,
|
||||
args: &mut RawArgs<'a>,
|
||||
) -> ConsumeResult<'a> {
|
||||
let name_opt: Option<&'a str> = args.pop().map(|arg| arg.value);
|
||||
|
||||
let result: Option<Arg<'a>> = name_opt.map_or_else(
|
||||
|| None,
|
||||
|name| {
|
||||
Particle::from_name(name.strip_prefix("minecraft:").unwrap_or(name))
|
||||
.map(Arg::Particle)
|
||||
},
|
||||
);
|
||||
|
||||
Box::pin(async move { result })
|
||||
let name = args.pop().map(|arg| arg.value)?;
|
||||
Particle::from_name(name.strip_prefix("minecraft:").unwrap_or(name)).map(Arg::Particle)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user