From b422e041f48b3003f2a42ef2201c2bf9d03f4b81 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 13 Nov 2022 09:57:09 -0500 Subject: [PATCH] Fixed #7906 --- core/src/mindustry/input/InputHandler.java | 12 ++++++------ core/src/mindustry/net/Administration.java | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index 620d0129f1..88f8910378 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -282,17 +282,17 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ public static void commandBuilding(Player player, int[] buildings, Vec2 target){ if(player == null || target == null) return; + if(net.server() && !netServer.admins.allowAction(player, ActionType.commandBuilding, event -> { + event.buildingPositions = buildings; + })){ + throw new ValidateException(player, "Player cannot command buildings."); + } + for(int pos : buildings){ var build = world.build(pos); if(build == null || build.team() != player.team() || !build.block.commandable) continue; - if(net.server() && !netServer.admins.allowAction(player, ActionType.commandBuilding, event -> { - event.tile = build.tile; - })){ - throw new ValidateException(player, "Player cannot command building."); - } - build.onCommand(target); if(!state.isPaused() && player == Vars.player){ Fx.moveCommand.at(target); diff --git a/core/src/mindustry/net/Administration.java b/core/src/mindustry/net/Administration.java index a52e962e86..afc120910d 100644 --- a/core/src/mindustry/net/Administration.java +++ b/core/src/mindustry/net/Administration.java @@ -650,6 +650,9 @@ public class Administration{ /** valid only for command unit events */ public @Nullable int[] unitIDs; + /** valid only for command building events */ + public @Nullable int[] buildingPositions; + public PlayerAction set(Player player, ActionType type, Tile tile){ this.player = player; this.type = type;