-
-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commands: Fix Bug, Refactor Arguments, Add /tp #227
Conversation
I would prefer to have all arguments in a folder like the commands, makes it much cleaner |
I've already been working on that actually, but before I can commit that I need another issue to be resolved: IMO ArgumentConsumer's consume function should just return an Option instead of a Result<String, Option>. As discussed in the comment in CommandDispatcher, we can really use these optional error strings anyways, at least not without a lot of complexity that will slow us down. See dispatcher.rs
Removing this Error in favor of just using an option makes the Argument Consumers much much cleaner too. Additionally, the aforementioned CommandArgument would be an enum that has a variant for each arguments type: This way we can simply store parsed data in the HashMap, instead of converting consumed data back to a String and having a second parse step. |
Sure, We can use an Option. But i would like to have proper "Error Handling" in some way. I don't want to just give the player back "Wrong Argument", This is confusing. |
We could go through all possible paths, and find the path that we can traverse the furthest before consuption of an argument fails. I believe that's what Minecraft does. Then we could print the syntax of that path up to that point. This will have to wait tho, as it depends on being able to print possible continuations from any node in a path. This might also be related to command suggestions |
I belive this is what we did before i made custom error reporting. Im not totally against this. But for "not experienced players". An proper error message like "Player not Found". Is more clear than " wrong Argument" or something like that |
I honestly think when #94 is implemented this is not really a problem, or at least relatively low priority. If you think this is important you could open a seperate issue for that |
btw you have a typo you wrote arg_postition_2d.rs |
Is this ready for merge ? |
I just did some last testing, I think it's ready 👍 |
Big Thanks @user622628252416. Really appreciate your work :D |
* fix command dispatch, add/refactor arguments & add tp command * implement teleport facing location/facing entity * implement teleport facing location/facing entity * implement arg_player/arg_entity and refactor commands accordingly * implement ~ coordinate notation * refactor arg_position_3d * major command refactor * add documentation * add default names to more argument types * add argument names to arg_bounded_nums * change command argument api --------- Co-authored-by: user622628252416 <[email protected]>
Description
Testing
ran commands and evaluated their effects a lot (especially affected commands: help/tp/worldborder)
Checklist
cargo fmt
cargo clippy