Skip to content

Commit

Permalink
make sure the players gamemode is creative when client sends SSetCrea…
Browse files Browse the repository at this point in the history
…tiveSlot
  • Loading branch information
Bryntet committed Aug 21, 2024
1 parent d80bbb7 commit 3bbe19f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pumpkin/src/client/player_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,10 @@ impl Client {
}

pub fn handle_set_creative_slot(&mut self, _server: &mut Server, packet: SSetCreativeSlot) {
let gamemode = self.player.as_ref().unwrap().gamemode;
if gamemode != GameMode::Creative {
self.kick("CHEATER")
}
let inventory = &mut self.player.as_mut().unwrap().inventory;

inventory.set_slot(packet.slot as usize, packet.clicked_item.to_item(), false);
Expand Down

0 comments on commit 3bbe19f

Please sign in to comment.