Open Snowiiii opened 1 month ago
Would attribute macro's be something you'd be okay with? that's kind of the thing I would go for.
Something like
#[command(
names = ["kick"],
description = "Kicks the player from the server."
)]
struct KickCommand {
target: PlayerName,
reason: String,
}
impl CommandHandler for KickCommand {
pub fn init_command_tree<'a>(...) -> CommandTree<'a> {
...
}
}
What exactly is the use of the Command tree struct? I think we could just have the command handler execute the command and be done with it no?
What exactly is the use of the Command tree struct? I think we could just have the command handler execute the command and be done with it no?
Its pretty useful for tab completion and also a quick and easy way to check permission etc. Look at Mojang's Brigadier API
Yeah I see it now, I think if we use macros we'll need to have a way to handle arguments that require more arguments aswell, it needs to be evaluated in a chain before we execute anything
Maybe we could have a CommandArg
struct which has the argument and a bool dictating whether more arguments are required, then in the command tree we could pass in a custom struct for each command , which comes from the deserialised JSON of all the arguments
Macro rules good too like
command!{
names = ["kick"]
desc = "Kicks player"
{when goes comand tree
}
}
I'm thinking of improving the current design of our Command System which looks like this
One Problem for example is to no able to use Async Closures (yet).
Please let me know how do you think a Command System should look like?