Fixed #7906
This commit is contained in:
@@ -282,17 +282,17 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
public static void commandBuilding(Player player, int[] buildings, Vec2 target){
|
public static void commandBuilding(Player player, int[] buildings, Vec2 target){
|
||||||
if(player == null || target == null) return;
|
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){
|
for(int pos : buildings){
|
||||||
var build = world.build(pos);
|
var build = world.build(pos);
|
||||||
|
|
||||||
if(build == null || build.team() != player.team() || !build.block.commandable) continue;
|
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);
|
build.onCommand(target);
|
||||||
if(!state.isPaused() && player == Vars.player){
|
if(!state.isPaused() && player == Vars.player){
|
||||||
Fx.moveCommand.at(target);
|
Fx.moveCommand.at(target);
|
||||||
|
|||||||
@@ -650,6 +650,9 @@ public class Administration{
|
|||||||
/** valid only for command unit events */
|
/** valid only for command unit events */
|
||||||
public @Nullable int[] unitIDs;
|
public @Nullable int[] unitIDs;
|
||||||
|
|
||||||
|
/** valid only for command building events */
|
||||||
|
public @Nullable int[] buildingPositions;
|
||||||
|
|
||||||
public PlayerAction set(Player player, ActionType type, Tile tile){
|
public PlayerAction set(Player player, ActionType type, Tile tile){
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|||||||
Reference in New Issue
Block a user