Disallow the .fillFromCreative command outside of creative mode.

fixes #1022
fixes #743
This commit is contained in:
IntegratedQuantum 2025-02-09 17:32:55 +01:00
parent c9bac6377e
commit 5bea8f41b6

View File

@ -1394,8 +1394,10 @@ pub const Command = struct { // MARK: Command
item: ?Item,
amount: u16 = 0,
fn run(self: FillFromCreative, allocator: NeverFailingAllocator, cmd: *Command, side: Side, _: ?*main.server.User, _: Gamemode) error{serverFailure}!void {
fn run(self: FillFromCreative, allocator: NeverFailingAllocator, cmd: *Command, side: Side, user: ?*main.server.User, mode: Gamemode) error{serverFailure}!void {
if(self.dest.inv.type == .workbench and self.dest.slot == 25) return;
if(side == .server and user != null and mode != .creative) return;
if(side == .client and mode != .creative) return;
if(!self.dest.ref().empty()) {
cmd.executeBaseOperation(allocator, .{.delete = .{