Skip to content

Commit

Permalink
Merge pull request #51 from Bryntet/master
Browse files Browse the repository at this point in the history
Add permissions check for SSetCreativeSlot
  • Loading branch information
Snowiiii authored Aug 21, 2024
2 parents 38931f6 + e34fc47 commit ee4bde9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pumpkin/src/client/player_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,12 @@ impl Client {
}

pub fn handle_set_creative_slot(&mut self, _server: &mut Server, packet: SSetCreativeSlot) {
let inventory = &mut self.player.as_mut().unwrap().inventory;
let player = self.player.as_mut().unwrap();
if player.gamemode != GameMode::Creative {
self.kick("Invalid action, you can only do that if you are in creative");
return;
}
let inventory = &mut player.inventory;

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

0 comments on commit ee4bde9

Please sign in to comment.