From 11721b2a464c99d334cdcf05ac240aaafd0b5c56 Mon Sep 17 00:00:00 2001 From: Arazadaz Date: Sun, 11 Feb 2024 21:19:06 -0600 Subject: [PATCH] Fixed logical order of commands. Args were stacked on top of each other instead of pointing to the previous arg. --- .../com/arazadaz/dd/commands/DDCommands.java | 60 ++++++++++++------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/arazadaz/dd/commands/DDCommands.java b/src/main/java/com/arazadaz/dd/commands/DDCommands.java index 89e1481..62827f5 100644 --- a/src/main/java/com/arazadaz/dd/commands/DDCommands.java +++ b/src/main/java/com/arazadaz/dd/commands/DDCommands.java @@ -139,28 +139,44 @@ private static int registerNewOrigin(CommandContext context) public static void registerCommands(CommandDispatcher dispatcher){ - dispatcher.register(Commands.literal("getNearestOriginInfo").requires(commandSource -> - commandSource.hasPermission(3)) - .executes(DDCommands::getNearestOriginInfo) - .then(Commands.argument("tag", StringArgumentType.word()) - .executes(DDCommands::getNearestOriginInfo)) - .then(Commands.argument("difficulty mode", StringArgumentType.word()) - .executes(DDCommands::getNearestOriginInfo)) - .then(Commands.argument("radius mode", StringArgumentType.word()) - .executes(DDCommands::getNearestOriginInfo))); - - - - - dispatcher.register((Commands.literal("createOrigin").requires(commandSource -> - commandSource.hasPermission(3)) - .executes(DDCommands::registerNewOrigin)) - .then(Commands.argument("tag", StringArgumentType.word()) - .executes(DDCommands::registerNewOrigin)) - .then(Commands.argument("range", DoubleArgumentType.doubleArg(0)) - .executes(DDCommands::registerNewOrigin)) - .then(Commands.argument("noCalculationBound", StringArgumentType.word()) - .executes(DDCommands::registerNewOrigin))); + dispatcher.register( + Commands.literal("getNearestOriginInfo") + .requires(commandSource -> commandSource.hasPermission(3)) + .executes(DDCommands::getNearestOriginInfo) + .then( + Commands.argument("tag", StringArgumentType.word()) + .executes(DDCommands::getNearestOriginInfo) + .then( + Commands.argument("difficulty mode", StringArgumentType.word()) + .executes(DDCommands::getNearestOriginInfo) + .then( + Commands.argument("radius mode", StringArgumentType.word()) + .executes(DDCommands::getNearestOriginInfo) + ) + ) + ) + ); + + + + + dispatcher.register( + Commands.literal("createOrigin") + .requires(commandSource -> commandSource.hasPermission(3)) + .executes(DDCommands::registerNewOrigin) + .then( + Commands.argument("tag", StringArgumentType.word()) + .executes(DDCommands::registerNewOrigin) + .then( + Commands.argument("range", DoubleArgumentType.doubleArg(0)) + .executes(DDCommands::registerNewOrigin) + .then( + Commands.argument("noCalculationBound", StringArgumentType.word()) + .executes(DDCommands::registerNewOrigin) + ) + ) + ) + ); } }