The Wayback Machine - https://web.archive.org/web/20211018214809/https://github.com/feather-rs/feather/issues/229
Skip to content
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

Tracking issue: complete command support #229

Open
caelunshun opened this issue May 18, 2020 · 6 comments
Open

Tracking issue: complete command support #229

caelunshun opened this issue May 18, 2020 · 6 comments

Comments

@caelunshun
Copy link
Member

@caelunshun caelunshun commented May 18, 2020

#209 added initial support for commands using lieutenant and implemented /tp and /gamemode. What's left to do:

For newcomers to the project, implementing a command is a good way to start. The basic process is:

  • Locate the Minecraft Wiki page for the command and read through it, so you understand the command well (skip any Bedrock-specific sections).
  • Go into server/commands/src/impls.rs and implement the command.
    • The tp implementation is a good example of how a command could be implemented.
    • If you need a new argument type (for example, a parsed gamemode or a UUID), implement it in server/commands/src/arguments.rs. EntitySelector and ParsedGamemode are useful examples to see how this is done.

If you need any help, you are welcome to ask as many questions as you need on our Discord server :)

@ambeeeeee
Copy link
Contributor

@ambeeeeee ambeeeeee commented May 18, 2020

I'm currently working on the tell command.

caelunshun pushed a commit that referenced this issue May 19, 2020
Adds /tell command for #229 which works as described here.

This has not been tested with multiple accounts.
caelunshun pushed a commit that referenced this issue May 22, 2020
Adds /me <action> command for #229 which is described here.

This has not been tested on multiple accounts. The text for the command was deduced from running /me on a 1.15.2 server from both the console (which appears as @) and a normal player account.
@BuggStream
Copy link
Contributor

@BuggStream BuggStream commented Jul 1, 2020

I think I will start working on the /weather command.

@Miro-Andrin
Copy link
Contributor

@Miro-Andrin Miro-Andrin commented Jul 30, 2020

I have written some python code to parse the commands.json file that you can generate from the server jar. Using this i have generated (almost) all the functions one would need to implement to reach 99% vanilla command support.

The included file commands.txt contains (almost) all the functions that one would eventually need to implement. As an example here is one of the xp commands. For now i have them returning a "not implemented msg", but we would have to implement their functionality here.

#[command(usage="xp add <targets> <amount> points")]
pub fn xp2(
    targets : MultiplePlayers, amount : IntegerArgument
) -> anyhow::Result<()>{
    if let Some(mut sender_message_receiver) = ctx.world.try_get_mut::<MessageReceiver>(ctx.sender)
    {
        let return_text = Text::from("This command \"xp add <targets> <amount> points\" is not implemented in this version of feather.").gray().italic();
        sender_message_receiver.send(return_text);
    }
    return Ok(())
}

The included file parsers.txt has a list of the 50 to 60 ish parsers that the commands in commands.rs assume we have implemented.
As an example here is the parser for BlockPos.

#[derive(Debug, Error)]
pub enum BlockPosParseError {}

#[derive(Clone, Debug)]
pub struct BlockPos(pub String);

impl ArgumentKind<CommandCtx> for BlockPos {
    type ParseError = BlockPosParseError;

    fn satisfies<'a>(_ctx: &CommandCtx, input: &mut Input<'a>) -> bool {
        input.advance_until(" ");
        //TODO 
        true
    }

    fn parse<'a>(_ctx: &CommandCtx, input: &mut Input<'a>) -> Result<Self, Self::ParseError> {
        let text = input.advance_until(" ");
        //TODO
        Ok(BlockPos(text.to_owned()))
    }
}

With my scripts i am able to load two different versions of minecrafts commands.json file and see what changes have been made. This would make it possible to track changes in vanilla commands, and get a "diff" for every release, stating what rust code needs to be added/removed. I want to know if the maintainers would be interested in including the generated files. I am not suggesting we add python as part of the build process, just the generated code. If you want to include the generated code, then i am going to spend some time improving the script and release it, and also spend the time creating a pull request.

parsers.txt

commands.txt

@caelunshun
Copy link
Member Author

@caelunshun caelunshun commented Jul 31, 2020

@Miro-Andrin Wow, that's impressive, thanks for this! I'd be happy to include these generated files as part of the commands crate. Including the generator script in this repo seems like a good idea, in case we want to regenerate the code for some reason, but it doesn't have to be a mandatory build dependency.

@CDFN
Copy link
Contributor

@CDFN CDFN commented Sep 19, 2020

stop command is already implemented (#260), mark it as done please :)
Same with clear.

CDFN pushed a commit to CDFN/feather that referenced this issue Sep 19, 2020
tcmal added a commit to tcmal/feather that referenced this issue Oct 4, 2020
Loading from bans.toml, including reasons and expiry times. 

Also implements /ban, /ban-ip, /pardon and /pardon-ip (feather-rs#229)
tcmal added a commit to tcmal/feather that referenced this issue Oct 4, 2020
Loading from bans.toml, including reasons and expiry times. 

Also implements /ban, /ban-ip, /pardon and /pardon-ip (feather-rs#229)
tcmal added a commit to tcmal/feather that referenced this issue Oct 4, 2020
Loading from bans.toml, including reasons and expiry times.

Also implements /ban, /ban-ip, /pardon and /pardon-ip (feather-rs#229)
tcmal added a commit to tcmal/feather that referenced this issue Oct 4, 2020
Loading from bans.toml, including reasons and expiry times.

Also implements /ban, /ban-ip, /pardon and /pardon-ip (feather-rs#229)
tcmal added a commit to tcmal/feather that referenced this issue Oct 4, 2020
Loading from bans.toml, including reasons and expiry times.

Also implements /ban, /ban-ip, /pardon and /pardon-ip (feather-rs#229)
tcmal added a commit to tcmal/feather that referenced this issue Oct 13, 2020
Loading from bans.toml, including reasons and expiry times.

Also implements /ban, /ban-ip, /pardon and /pardon-ip (feather-rs#229).
@nobbele nobbele mentioned this issue Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment