-
Notifications
You must be signed in to change notification settings - Fork 146
Add an ability to change gamemode from plugins #521
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
Conversation
feather/server/src/client.rs
Outdated
| pub fn change_gamemode(&self, gamemode: Gamemode) { | ||
| self.send_packet(ChangeGameState { | ||
| reason: StateReason::ChangeGameMode, | ||
| value: gamemode as u8 as f32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change the protocol to take Gamemode and implement write on game mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ChangeGameState requires it to be f64, so I did it in a different way.
| }); | ||
| } | ||
| for (entity, flying) in fly_changes { | ||
| if flying { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if statement is redundant, just create CreativeFlyingEvent with the value of flying?
Add an ability to change gamemode from plugins
Status
Description
Adds GamemodeEvent, InstabreakChangeEvent, FlyingAbilityChangeEvent, BuildingAbilityChangeEvent, and InvulnerabilityChangeEvent. This code was taken from #487 (I had to implement this for /gamemode command), but I think this change deserves a separate PR.
Related issues
Checklist
cargo fmt,cargo clippy --all-targets,cargo build --releaseandcargo testand fixed any generated errors!Note: if you locally don't get any errors, but GitHub Actions fails (especially at
clippy) you might want to check your rust toolchain version. You can then feel free to fix these warnings/errors in your PR.