Skip to content

Commit

Permalink
Fixed logical order of commands. Args were stacked on top of each oth…
Browse files Browse the repository at this point in the history
…er instead of pointing to the previous arg.
  • Loading branch information
arazadaz committed Feb 12, 2024
1 parent 52d4344 commit 11721b2
Showing 1 changed file with 38 additions and 22 deletions.
60 changes: 38 additions & 22 deletions src/main/java/com/arazadaz/dd/commands/DDCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,28 +139,44 @@ private static int registerNewOrigin(CommandContext<CommandSourceStack> context)


public static void registerCommands(CommandDispatcher<CommandSourceStack> 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)
)
)
)
);
}

}

0 comments on commit 11721b2

Please sign in to comment.