From d5681bbb8d16934b2a4d93b12d06208e881eb7b6 Mon Sep 17 00:00:00 2001 From: YouHaveTrouble Date: Fri, 6 Dec 2024 19:18:56 +0100 Subject: [PATCH] fixed command argument order --- .../blockedit/BlockEditCommands.java | 53 ++++++++++--------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/main/java/me/youhavetrouble/blockedit/BlockEditCommands.java b/src/main/java/me/youhavetrouble/blockedit/BlockEditCommands.java index ec51835..9f08b40 100644 --- a/src/main/java/me/youhavetrouble/blockedit/BlockEditCommands.java +++ b/src/main/java/me/youhavetrouble/blockedit/BlockEditCommands.java @@ -256,19 +256,20 @@ public class BlockEditCommands { player.sendMessage(Component.text(BELocale.getLocale(player.locale()).settingBlocks, NamedTextColor.GRAY)); return Command.SINGLE_SUCCESS; }) + .then( + Commands.argument("chunks_per_tick", IntegerArgumentType.integer(1)) + .executes(ctx -> { + Player player = (Player) ctx.getSource().getSender(); + BEPlayer bePlayer = BEPlayer.getByPlayer(player); + BlockState blockState = ctx.getArgument("block", BlockState.class); + int chunksPerTick = ctx.getArgument("chunks_per_tick", Integer.class); + Selection selection = bePlayer.getSelection(); + BlockEditAPI.runOperation(selection, chunksPerTick, new SetOperation(blockState)); + player.sendMessage(Component.text(BELocale.getLocale(player.locale()).settingBlocks, NamedTextColor.GRAY)); + return Command.SINGLE_SUCCESS; + })) ) - .then( - Commands.argument("chunks_per_tick", IntegerArgumentType.integer(1)) - .executes(ctx -> { - Player player = (Player) ctx.getSource().getSender(); - BEPlayer bePlayer = BEPlayer.getByPlayer(player); - BlockState blockState = ctx.getArgument("block", BlockState.class); - int chunksPerTick = ctx.getArgument("chunks_per_tick", Integer.class); - Selection selection = bePlayer.getSelection(); - BlockEditAPI.runOperation(selection, chunksPerTick, new SetOperation(blockState)); - player.sendMessage(Component.text(BELocale.getLocale(player.locale()).settingBlocks, NamedTextColor.GRAY)); - return Command.SINGLE_SUCCESS; - })) + .build(); } @@ -293,20 +294,20 @@ public class BlockEditCommands { player.sendMessage(Component.text(BELocale.getLocale(player.locale()).replacingBlocks, NamedTextColor.GRAY)); return Command.SINGLE_SUCCESS; }) - ) - .then( - Commands.argument("chunks_per_tick", IntegerArgumentType.integer(1)) - .executes(ctx -> { - Player player = (Player) ctx.getSource().getSender(); - BEPlayer bePlayer = BEPlayer.getByPlayer(player); - BlockState toReplace = ctx.getArgument("to_replace", BlockState.class); - BlockState replaceWith = ctx.getArgument("replace_with", BlockState.class); - int chunksPerTick = ctx.getArgument("chunks_per_tick", Integer.class); - Selection selection = bePlayer.getSelection(); - BlockEditAPI.runOperation(selection, chunksPerTick, new ReplaceOperation(toReplace, replaceWith)); - player.sendMessage(Component.text(BELocale.getLocale(player.locale()).replacingBlocks, NamedTextColor.GRAY)); - return Command.SINGLE_SUCCESS; - }) + .then( + Commands.argument("chunks_per_tick", IntegerArgumentType.integer(1)) + .executes(ctx -> { + Player player = (Player) ctx.getSource().getSender(); + BEPlayer bePlayer = BEPlayer.getByPlayer(player); + BlockState toReplace = ctx.getArgument("to_replace", BlockState.class); + BlockState replaceWith = ctx.getArgument("replace_with", BlockState.class); + int chunksPerTick = ctx.getArgument("chunks_per_tick", Integer.class); + Selection selection = bePlayer.getSelection(); + BlockEditAPI.runOperation(selection, chunksPerTick, new ReplaceOperation(toReplace, replaceWith)); + player.sendMessage(Component.text(BELocale.getLocale(player.locale()).replacingBlocks, NamedTextColor.GRAY)); + return Command.SINGLE_SUCCESS; + }) + ) ) .build(); }