Skip to content

Vanilla-ish commands#67

Merged
ReCore-sys merged 31 commits into
devfrom
feature/vanilla-commands
Jul 2, 2026
Merged

Vanilla-ish commands#67
ReCore-sys merged 31 commits into
devfrom
feature/vanilla-commands

Conversation

@ReCore-sys

Copy link
Copy Markdown
Contributor

After a stupid amount of time losing my mind over macro code, here's some kinda impressive command nonsense.

Description

Replaced the entire command system (sorry @radstevee) with a new macro and enum based system. It should hopefully be as simple as possible to create new commands from just an enum/struct, a macro and filling out a trait. It is able to replicate the vanilla command system pretty much entirely so with the exception of some of the more complicated commands (/execute im looking at you) we should be able to get vanilla compatible commands.

Motivation and Context

The old system had a lot of problems personality, but it was pretty limited and kinda tricky to use from a developer standpoint. This new system is fairly simple to use and should be considerably better.

How has this been tested?

Bunch of unit tests and in-game testing.

Screenshots (if appropriate):

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (restructuring code, without changing its behavior)

Checklist:

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Clippy passes with no warnings.

@ReCore-sys ReCore-sys added enhancement New feature or request refactor Something isn't right in terms of orgnisation labels Jun 28, 2026
@radstevee

Copy link
Copy Markdown
Collaborator

I haven't taken a definitive look to be able to give a review or point out things, but this generally looks like a huge improvement to the old system

@ReCore-sys ReCore-sys moved this from TBD to Reviewing in Temper's to-do list Jun 28, 2026

@MSKatKing MSKatKing left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks really good! I just had a couple questions and one concern, so if you wouldn't mind taking a look at those that would amazing!


#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PositionArg {
pub x: String,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason this should be stored as a String? Could it be better to store it as a separate struct or tuple that has the f64 coord and a flag for if it's relative?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had it this way so the relative-ness and parsing could all be handled in one function, but I don't think it makes all that might difference in the end.

Comment thread src/command-infra/src/ecs.rs Outdated
Comment thread src/default_commands/src/credits.rs Outdated
Comment thread src/default_commands/src/gamemode.rs Outdated
Comment thread src/default_commands/src/kill.rs Outdated
Comment thread src/default_commands/src/tp.rs Outdated
Comment thread src/command-infra/src/ecs.rs Outdated
.is_ok_and(|player_permissions| player_permissions.can(permission)),
}
};
if let Some(permission) = C::permission()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If permissions are checked here then why do some handlers check it themselves? Should a precondition for the handler function be stated as the CommandSource having the necessary permissions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look I'm not going to lie, I forgot I added this by the time I got around to making the commands.

@ReCore-sys ReCore-sys merged commit 2a20967 into dev Jul 2, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Reviewing to Done in Temper's to-do list Jul 2, 2026
@ReCore-sys ReCore-sys deleted the feature/vanilla-commands branch July 2, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request refactor Something isn't right in terms of orgnisation

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants